mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support mysql_driver_6.0.x
This commit is contained in:
@@ -15,10 +15,13 @@
|
||||
*/
|
||||
package com.alibaba.druid.pool;
|
||||
|
||||
import java.sql.DriverManager;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Driver;
|
||||
import java.sql.DriverManager;
|
||||
|
||||
public class TestMySqlPing extends TestCase {
|
||||
|
||||
public void test_ping() throws Exception {
|
||||
@@ -26,15 +29,16 @@ public class TestMySqlPing extends TestCase {
|
||||
String user = "dragoon_admin";
|
||||
String password = "dragoon_root";
|
||||
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
Driver driver = (Driver) Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||
|
||||
com.mysql.jdbc.Connection conn = (com.mysql.jdbc.Connection) DriverManager.getConnection(url, user, password);
|
||||
Connection conn = DriverManager.getConnection(url, user, password);
|
||||
ping(conn);
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void ping(com.mysql.jdbc.Connection conn) throws Exception {
|
||||
public void ping(Connection conn) throws Exception {
|
||||
System.out.println(conn.getClass());
|
||||
conn.ping();
|
||||
Method method = conn.getClass().getMethod("pring");
|
||||
method.invoke(conn);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user