Search in sources :

Example 16 with DbException

use of org.adbcj.DbException in project adbcj by mheath.

the class SelectTest method testBrokenSelect.

public void testBrokenSelect() throws Exception {
    Connection connection = connectionManager.connect().get();
    DbSessionFuture<ResultSet> future = connection.executeQuery("SELECT broken_query");
    try {
        future.get(5, TimeUnit.SECONDS);
        throw new AssertionError("Issues a bad query, future should have failed");
    } catch (DbException e) {
    // Pass
    } finally {
        connection.close(true).get();
    }
}
Also used : Connection(org.adbcj.Connection) ResultSet(org.adbcj.ResultSet) DbException(org.adbcj.DbException)

Aggregations

DbException (org.adbcj.DbException)16 Connection (org.adbcj.Connection)7 URI (java.net.URI)5 URISyntaxException (java.net.URISyntaxException)5 SQLException (java.sql.SQLException)2 ResultSet (org.adbcj.ResultSet)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 TimeoutException (java.util.concurrent.TimeoutException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ConnectionManager (org.adbcj.ConnectionManager)1 DbFuture (org.adbcj.DbFuture)1 DbListener (org.adbcj.DbListener)1 DbFutureConcurrentProxy (org.adbcj.support.DbFutureConcurrentProxy)1 DefaultDbFuture (org.adbcj.support.DefaultDbFuture)1 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1