本文整理汇总了Java中org.apache.tomcat.jdbc.pool.DataSourceProxy.setJdbcInterceptors方法的典型用法代码示例。如果您正苦于以下问题:Java DataSourceProxy.setJdbcInterceptors方法的具体用法?Java DataSourceProxy.setJdbcInterceptors怎么用?Java DataSourceProxy.setJdbcInterceptors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tomcat.jdbc.pool.DataSourceProxy
的用法示例。
在下文中一共展示了DataSourceProxy.setJdbcInterceptors方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDefaultCatalog
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
@Test
public void testDefaultCatalog() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultCatalog("information_schema");
d1.setMinIdle(1);
Connection c1 = d1.getConnection();
Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
c1.close();
c1 = d1.getConnection();
Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
c1.setCatalog("mysql");
Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
c1.close();
c1 = d1.getConnection();
Assert.assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
}
示例2: testAutoCommitFalse
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
@Test
public void testAutoCommitFalse() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setMinIdle(1);
d1.setMaxIdle(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultAutoCommit(Boolean.FALSE);
Connection c1 = d1.getConnection();
Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
c1.setAutoCommit(true);
Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
c1.close();
c1 = d1.getConnection();
Assert.assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
d1.close(true);
Assert.assertTrue("Connection should be closed",c1.isClosed());
}
示例3: testAutoCommitFalse
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
public void testAutoCommitFalse() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setMinIdle(1);
d1.setMaxIdle(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultAutoCommit(Boolean.FALSE);
Connection c1 = d1.getConnection();
assertFalse("Auto commit should be false",c1.getAutoCommit());
c1.setAutoCommit(true);
assertTrue("Auto commit should be true",c1.getAutoCommit());
c1.close();
c1 = d1.getConnection();
assertFalse("Auto commit should be false for a reused connection",c1.getAutoCommit());
d1.close(true);
assertTrue("Connection should be closed",c1.isClosed());
}
示例4: testDefaultCatalog
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
public void testDefaultCatalog() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultCatalog("information_schema");
d1.setMinIdle(1);
Connection c1 = d1.getConnection();
assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
c1.close();
c1 = d1.getConnection();
assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
c1.setCatalog("mysql");
assertEquals("Catalog should be information_schema",c1.getCatalog(),"mysql");
c1.close();
c1 = d1.getConnection();
assertEquals("Catalog should be information_schema",c1.getCatalog(),"information_schema");
}
示例5: testAutoCommitTrue
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
@Test
public void testAutoCommitTrue() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultAutoCommit(Boolean.TRUE);
d1.setMinIdle(1);
Connection c1 = d1.getConnection();
Assert.assertTrue("Auto commit should be true",c1.getAutoCommit());
c1.setAutoCommit(false);
Assert.assertFalse("Auto commit should be false",c1.getAutoCommit());
c1.close();
c1 = d1.getConnection();
Assert.assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
}
示例6: testAutoCommitTrue
import org.apache.tomcat.jdbc.pool.DataSourceProxy; //导入方法依赖的package包/类
public void testAutoCommitTrue() throws Exception {
DataSourceProxy d1 = this.createDefaultDataSource();
d1.setMaxActive(1);
d1.setJdbcInterceptors(ConnectionState.class.getName());
d1.setDefaultAutoCommit(Boolean.TRUE);
d1.setMinIdle(1);
Connection c1 = d1.getConnection();
assertTrue("Auto commit should be true",c1.getAutoCommit());
c1.setAutoCommit(false);
assertFalse("Auto commit should be false",c1.getAutoCommit());
c1.close();
c1 = d1.getConnection();
assertTrue("Auto commit should be true for a reused connection",c1.getAutoCommit());
}