Search in sources :

Example 1 with JDBCDataSource

use of org.apache.derbyTesting.junit.JDBCDataSource in project derby by apache.

the class cdsXid method testCreateInDatabaseName_DS.

/**
 * Test that a connection to JDBCDataSource can be established
 * successfully while creating a database using setDatabaseName()
 * with create=true
 *
 * @throws SQLException
 */
public void testCreateInDatabaseName_DS() throws SQLException {
    DataSource ds = JDBCDataSource.getDataSource();
    String dbName = TestConfiguration.getCurrent().getDefaultDatabaseName();
    JDBCDataSource.setBeanProperty(ds, "databaseName", dbName + ";create=true");
    Connection c = ds.getConnection();
    c.setAutoCommit(false);
    c.close();
}
Also used : Connection(java.sql.Connection) XAConnection(javax.sql.XAConnection) PooledConnection(javax.sql.PooledConnection) XADataSource(javax.sql.XADataSource) J2EEDataSource(org.apache.derbyTesting.junit.J2EEDataSource) DataSource(javax.sql.DataSource) ConnectionPoolDataSource(javax.sql.ConnectionPoolDataSource) JDBCDataSource(org.apache.derbyTesting.junit.JDBCDataSource)

Aggregations

Connection (java.sql.Connection)1 ConnectionPoolDataSource (javax.sql.ConnectionPoolDataSource)1 DataSource (javax.sql.DataSource)1 PooledConnection (javax.sql.PooledConnection)1 XAConnection (javax.sql.XAConnection)1 XADataSource (javax.sql.XADataSource)1 J2EEDataSource (org.apache.derbyTesting.junit.J2EEDataSource)1 JDBCDataSource (org.apache.derbyTesting.junit.JDBCDataSource)1