use of javax.sql.ConnectionPoolDataSource in project derby by apache.
the class PoolDSAuthenticationTest method assertConnectionWOUPFail.
protected void assertConnectionWOUPFail(String expectedSqlState, String dbName, String user, String password) throws SQLException {
ConnectionPoolDataSource pds = J2EEDataSource.getConnectionPoolDataSource();
JDBCDataSource.setBeanProperty(pds, "databaseName", dbName);
JDBCDataSource.setBeanProperty(pds, "user", user);
JDBCDataSource.setBeanProperty(pds, "password", password);
try {
pds.getPooledConnection();
fail("Connection should've been refused/failed");
} catch (SQLException e) {
assertSQLState(expectedSqlState, e);
}
}
use of javax.sql.ConnectionPoolDataSource in project derby by apache.
the class PoolDSAuthenticationTest method assertConnectionWOUPOK.
protected void assertConnectionWOUPOK(String dbName, String user, String password) throws SQLException {
ConnectionPoolDataSource pds = J2EEDataSource.getConnectionPoolDataSource();
JDBCDataSource.setBeanProperty(pds, "databaseName", dbName);
JDBCDataSource.setBeanProperty(pds, "user", user);
JDBCDataSource.setBeanProperty(pds, "password", password);
pds.getPooledConnection().close();
}
use of javax.sql.ConnectionPoolDataSource in project derby by apache.
the class PoolDSAuthenticationTest method assertShutdownUsingConnAttrsOK.
protected void assertShutdownUsingConnAttrsOK(String dbName, String user, String password) throws SQLException {
ConnectionPoolDataSource pds = J2EEDataSource.getConnectionPoolDataSource();
JDBCDataSource.setBeanProperty(pds, "connectionAttributes", "shutdown=true");
try {
pds.getPooledConnection(user, password);
fail("expected shutdown to fail");
} catch (SQLException e) {
// expect 08006 on successful shutdown
assertSQLState("08006", e);
}
}
use of javax.sql.ConnectionPoolDataSource in project derby by apache.
the class PoolDSAuthenticationTest method assertSystemShutdownFail.
protected void assertSystemShutdownFail(String expectedError, String dbName, String user, String password) throws SQLException {
ConnectionPoolDataSource pds = J2EEDataSource.getConnectionPoolDataSource();
JDBCDataSource.clearStringBeanProperty(pds, "databaseName");
JDBCDataSource.setBeanProperty(pds, "databaseName", dbName);
JDBCDataSource.setBeanProperty(pds, "shutdownDatabase", "shutdown");
JDBCDataSource.setBeanProperty(pds, "user", user);
JDBCDataSource.setBeanProperty(pds, "password", password);
try {
pds.getPooledConnection();
fail("expected shutdown to fail");
} catch (SQLException e) {
assertSQLState(expectedError, e);
}
}
use of javax.sql.ConnectionPoolDataSource in project derby by apache.
the class PoolDSAuthenticationTest method assertShutdownUsingSetShutdownOK.
protected void assertShutdownUsingSetShutdownOK(String dbName, String user, String password) throws SQLException {
ConnectionPoolDataSource pds = J2EEDataSource.getConnectionPoolDataSource();
JDBCDataSource.setBeanProperty(pds, "databaseName", dbName);
JDBCDataSource.setBeanProperty(pds, "shutdownDatabase", "shutdown");
try {
pds.getPooledConnection(user, password);
fail("expected a failed shutdown connection");
} catch (SQLException e) {
// expect 08006 on successful shutdown
assertSQLState("08006", e);
}
}
Aggregations