@Override public Statement createStatement() throws SQLException { checkNotClosed(); Statement statement = physicalConnection.createStatement(); statements.add(statement); return statement; }
@Override public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { checkNotClosed(); Statement statement = physicalConnection.createStatement(resultSetType, resultSetConcurrency); statements.add(statement); return statement; }
@Override public void setCatalog(String catalog) throws SQLException { checkNotClosed(); try { physicalConnection.setCatalog(catalog); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public int getHoldability() throws SQLException { checkNotClosed(); try { return physicalConnection.getHoldability(); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public Properties getClientInfo() throws SQLException { checkNotClosed(); try { return physicalConnection.getClientInfo(); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public void clearWarnings() throws SQLException { checkNotClosed(); try { physicalConnection.clearWarnings(); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public void setHoldability(int holdability) throws SQLException { checkNotClosed(); try { physicalConnection.setHoldability(holdability); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public String getCatalog() throws SQLException { checkNotClosed(); try { return physicalConnection.getCatalog(); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public void setTransactionIsolation(int level) throws SQLException { checkNotClosed(); try { physicalConnection.setTransactionIsolation(level); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public boolean isReadOnly() throws SQLException { checkNotClosed(); try { return physicalConnection.isReadOnly(); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public void setReadOnly(boolean readOnly) throws SQLException { checkNotClosed(); try { physicalConnection.setReadOnly(readOnly); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public DatabaseMetaData getMetaData() throws SQLException { checkNotClosed(); try { return physicalConnection.getMetaData(); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
@Override public void setAutoCommit(boolean autoCommit) throws SQLException { checkNotClosed(); try { physicalConnection.setAutoCommit(autoCommit); } catch (SQLException sqlException) { pooledCassandraConnection.connectionErrorOccurred(sqlException); throw sqlException; } }
private static void setup() throws InterruptedException { log.info("Setting up environment..."); Session conn = CassandraConnection.getSession(); conn.execute(DROP_KEYSPACE); conn.execute(CREATE_KEYSPACE); // sleep for 1 sec to allow cluster to consolidate Thread.sleep(1000); conn.execute(BLOGS_TABLE_DEF); conn.execute(INDEX_ON_BLOGS); conn.execute(POSTS_TABLE_DEF); conn.execute(CATEGORIES_TABLE_DEF); conn.execute(COMMENTS_TABLE_DEF); conn.execute(INDEX_ON_COMMENTS); conn.execute(POST_VOTES_TABLE_DEF); conn.execute(COMMENT_VOTES_TABLE_DEF); log.info("All set!"); conn.close(); }
@Override public boolean isValid(int timeout) throws SQLTimeoutException { return physicalConnection.isValid(timeout); }
/** ---- Helpers ---- */ private static final void cleanup() { CassandraConnection.closeClusterConnection(); }
@Override public void setClientInfo(Properties properties) throws SQLClientInfoException { if (!isClosed()) { physicalConnection.setClientInfo(properties); } }
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { if (!isClosed()) { physicalConnection.setClientInfo(name, value); } }