use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_addBatch.
public void test_addBatch() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.addBatch("select 1");
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.addBatch("select 1");
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_clearBatch.
public void test_clearBatch() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.clearBatch();
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.clearBatch();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_getMaxFieldSize.
public void test_getMaxFieldSize() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.setMaxFieldSize(23);
Assert.assertEquals(23, stmt.getMaxFieldSize());
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.getMaxFieldSize();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
SQLException error = null;
try {
stmt.setMaxFieldSize(23);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class PoolableStatementTest2 method test_getResultSetType.
public void test_getResultSetType() throws Exception {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.getResultSetType();
((DruidPooledStatement) stmt).getStatement().close();
{
SQLException error = null;
try {
stmt.getResultSetType();
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
conn.close();
}
use of com.alibaba.druid.pool.DruidPooledStatement in project druid by alibaba.
the class DruidPooledStatementTest method test_closeOnCompletion_error.
public void test_closeOnCompletion_error() throws Exception {
Connection conn = dataSource.getConnection();
DruidPooledStatement stmt = (DruidPooledStatement) conn.createStatement();
Assert.assertEquals(0, dataSource.getPoolingCount());
Assert.assertEquals(1, dataSource.getActiveCount());
Assert.assertEquals(0, dataSource.getErrorCount());
Exception error = null;
try {
stmt.closeOnCompletion();
} catch (SQLFeatureNotSupportedException e) {
error = e;
}
Assert.assertNotNull(error);
Assert.assertEquals(0, dataSource.getErrorCount());
stmt.close();
conn.close();
Assert.assertEquals(1, dataSource.getPoolingCount());
Assert.assertEquals(0, dataSource.getActiveCount());
}
Aggregations