Java Code Examples for org.hsqldb.jdbc.JDBCDriver

The following examples show how to use org.hsqldb.jdbc.JDBCDriver. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: evosql   Source File: JDBCXADataSource.java    License: Apache License 2.0 6 votes vote down vote up
/**
     * Get new XAConnection connection, to be managed by a connection manager.
     */
    public XAConnection getXAConnection() throws SQLException {

        // Comment out before public release:
/*
        System.err.print("Executing " + getClass().getName()
                         + ".getXAConnection()...");
*/

        // Use JDBCDriver directly so there is no need to register with DriverManager
        JDBCConnection connection =
            (JDBCConnection) JDBCDriver.getConnection(url, connectionProps);
        JDBCXAConnection xaConnection = new JDBCXAConnection(this, connection);

        return xaConnection;
    }
 
Example 2
Source Project: glowroot   Source File: JdbcServlet.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void executeApp() throws Exception {
    if (connection == null) {
        connection = JDBCDriver.getConnection("jdbc:hsqldb:mem:test", null);
        Statement statement = connection.createStatement();
        try {
            statement.execute("create table employee (name varchar(100))");
            statement.execute("insert into employee (name) values ('john doe')");
            statement.execute("insert into employee (name) values ('jane doe')");
            statement.execute("insert into employee (name) values ('sally doe')");
        } finally {
            statement.close();
        }
    }
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/jdbcservlet");
    MockHttpServletResponse response = new MockHttpServletResponse();
    service((ServletRequest) request, (ServletResponse) response);
}
 
Example 3
Source Project: evosql   Source File: Session.java    License: Apache License 2.0 4 votes vote down vote up
void releaseInternalConnection() {

        if (sessionContext.depth == 0) {
            JDBCDriver.driverInstance.threadConnection.set(null);
        }
    }
 
Example 4
Source Project: glowroot   Source File: Connections.java    License: Apache License 2.0 4 votes vote down vote up
private static Connection createHsqldbConnection() throws SQLException {
    Connection connection = JDBCDriver.getConnection("jdbc:hsqldb:mem:test", null);
    insertRecords(connection);
    return connection;
}
 
Example 5
@Test
public void testGetDriverLegacy() {
  IDatabaseDialect dialect = mock( IDatabaseDialect.class );
  assertEquals( JDBCDriver.class, PooledDatasourceHelper.getDriver( dialect, JDBCDriver.class.getCanonicalName(), null ).getClass() );
}
 
Example 6
Source Project: evosql   Source File: JDBCPooledDataSource.java    License: Apache License 2.0 3 votes vote down vote up
public PooledConnection getPooledConnection() throws SQLException {

        JDBCConnection connection =
            (JDBCConnection) JDBCDriver.getConnection(url, connectionProps);

        return new JDBCPooledConnection(connection);
    }
 
Example 7
Source Project: evosql   Source File: JDBCPooledDataSource.java    License: Apache License 2.0 3 votes vote down vote up
public PooledConnection getPooledConnection(String user,
        String password) throws SQLException {

    Properties props = new Properties();

    props.setProperty("user", user);
    props.setProperty("password", password);

    JDBCConnection connection =
        (JDBCConnection) JDBCDriver.getConnection(url, props);

    return new JDBCPooledConnection(connection);
}