mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
21 lines
583 B
Java
21 lines
583 B
Java
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();
|
|
}
|
|
}
|