本文整理汇总了Java中com.mysql.jdbc.interceptors.ServerStatusDiffInterceptor类的典型用法代码示例。如果您正苦于以下问题:Java ServerStatusDiffInterceptor类的具体用法?Java ServerStatusDiffInterceptor怎么用?Java ServerStatusDiffInterceptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerStatusDiffInterceptor类属于com.mysql.jdbc.interceptors包,在下文中一共展示了ServerStatusDiffInterceptor类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStatementInterceptors
import com.mysql.jdbc.interceptors.ServerStatusDiffInterceptor; //导入依赖的package包/类
public void testStatementInterceptors() throws Exception {
Connection interceptedConn = null;
/*
* try {
* Properties props = new Properties();
* props.setProperty("statementInterceptors", "com.mysql.jdbc.interceptors.ResultSetScannerInterceptor");
* props.setProperty("resultSetScannerRegex", ".*");
* interceptedConn = getConnectionWithProps(props);
* this.rs = interceptedConn.createStatement().executeQuery("SELECT 'abc'");
* this.rs.next();
* this.rs.getString(1);
* } finally {
* closeMemberJDBCResources();
*
* if (interceptedConn != null) {
* interceptedConn.close();
* }
* }
*/
try {
Properties props = new Properties();
props.setProperty("statementInterceptors", ServerStatusDiffInterceptor.class.getName());
interceptedConn = getConnectionWithProps(props);
this.rs = interceptedConn.createStatement().executeQuery("SELECT 'abc'");
} finally {
if (interceptedConn != null) {
interceptedConn.close();
}
}
}