use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class DruidPooledConnectionTest_prepareError method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(false);
dataSource.setFilters("stat");
dataSource.setPoolPreparedStatements(true);
dataSource.getProxyFilters().add(new FilterAdapter() {
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int autoGeneratedKeys) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, int[] columnIndexes) throws SQLException {
throw new SQLException();
}
@Override
public PreparedStatementProxy connection_prepareStatement(FilterChain chain, ConnectionProxy connection, String sql, String[] columnNames) throws SQLException {
throw new SQLException();
}
@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql) throws SQLException {
throw new SQLException();
}
@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new SQLException();
}
@Override
public CallableStatementProxy connection_prepareCall(FilterChain chain, ConnectionProxy connection, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new SQLException();
}
});
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class PSCacheTest2 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:x1");
dataSource.setPoolPreparedStatements(true);
dataSource.setMaxOpenPreparedStatements(10);
dataSource.setSharePreparedStatements(true);
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class PSCacheTest3 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:x1");
dataSource.setPoolPreparedStatements(true);
dataSource.setMaxOpenPreparedStatements(3);
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class ExceptionSorterTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setTestOnBorrow(true);
dataSource.setDbType("mysql");
dataSource.setPoolPreparedStatements(true);
dataSource.setFilters("stat");
dataSource.init();
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class KeepAliveTest method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:x1");
dataSource.setPoolPreparedStatements(true);
dataSource.setMinIdle(10);
dataSource.setMaxActive(20);
// dataSource.setMinEvictableIdleTimeMillis(30000);
// dataSource.setMaxEvictableIdleTimeMillis(30000);
dataSource.setTimeBetweenEvictionRunsMillis(10);
dataSource.setFilters("log4j");
dataSource.setValidationQuery("select 1");
Properties properties = new Properties();
properties.put("druid.keepAlive", "true");
dataSource.configFromPropety(properties);
}
Aggregations