optimized for mysql

This commit is contained in:
wenshao
2011-12-30 17:19:16 +08:00
parent 6df0ca991c
commit 028a1d4fb5
3 changed files with 26 additions and 53 deletions
@@ -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();
}
}