mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
optimized for mysql
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.druid.util;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
public class MySqlUtils {
|
||||
public static com.mysql.jdbc.Connection unwrap(Connection conn) throws SQLException {
|
||||
if (conn instanceof com.mysql.jdbc.Connection) {
|
||||
return (com.mysql.jdbc.Connection) conn;
|
||||
}
|
||||
|
||||
return conn.unwrap(com.mysql.jdbc.Connection.class);
|
||||
}
|
||||
|
||||
public static void ping(Connection conn) throws SQLException {
|
||||
com.mysql.jdbc.Connection mysqlConn = unwrap(conn);
|
||||
mysqlConn.ping();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user