@Override public Connection getConnection() throws SQLException { return _connectionPool.getConnection(); }
/** * Get JDBC connection * @return Connection * @throws SQLException SQL Exception */ public Connection getConnection() throws SQLException { return connectionPool.getConnection(); }
public Connection call() throws Exception { return getConnection(); } });
public Connection getConnectionFromPool() throws SQLException { return connectionPool.getConnection(); } }
public Connection call() throws Exception { return getConnection(); }}); }
public Connection getConnectionFromPool() throws SQLException { return connectionPool.getConnection(); }
public SqlEntityStore(BoneCP pool) { try { this.sql = new Sql(pool.getConnection()); } catch (SQLException e) { throw new RuntimeException(e); } }
public synchronized Connection getConnection() throws JdbcException { try { return bonecp.getConnection(); } catch (Exception e) { e.printStackTrace(); LOG.error("getConnection()", e); throw new JdbcException(e); } }
/** * Create a new connection session * @return session id * @throws SQLException SQL Exception */ public DDBSTransaction createSession() throws SQLException { Random random = new Random(); long mapKey; do { mapKey = random.nextLong(); } while (connectionSession.get(String.valueOf(mapKey)) != null); Connection connection = connectionPool.getConnection(); connectionSession.put(String.valueOf(mapKey), connection); return new DDBSTransaction(String.valueOf(mapKey)); }
/** * {@inheritDoc} * * @see javax.sql.DataSource#getConnection() */ @Override public Connection getConnection() throws SQLException { FinalWrapper<BoneCP> wrapper = this.pool; if (wrapper == null) { synchronized (this) { if (this.pool == null) { this.maybeInit(); } wrapper = this.pool; } } return wrapper.value.getConnection(); }
@Override public String getIdentifier() { String result = url; try { Connection connection = connectionPool.getConnection(); DatabaseMetaData metaData = connection.getMetaData(); int majorVersion, minorVersion; String productName, productVersion; majorVersion = metaData.getDatabaseMajorVersion(); minorVersion = metaData.getDatabaseMinorVersion(); productName = metaData.getDatabaseProductName(); productVersion = metaData.getDatabaseProductVersion(); result = String.format("%s (%s v%d.%d) - %s", productName, productVersion, majorVersion, minorVersion, url); } catch (SQLException e) { e.printStackTrace(); } return result; }
@Override public void deleteAll() { Statement st = null; Connection conn = null; try { conn = connectionPool.getConnection(); if(conn != null) { st = conn.createStatement(); final String deleteAllQuery = String.format("DELETE FROM %s", tableName); int deleted = st.executeUpdate(deleteAllQuery); LOG.debug("Deleted " + deleted + " jobs..."); } } catch (SQLException se) { LOG.error("SQL Error deleting all jobs: " , se); } finally { try { if(st != null) st.close(); if(conn != null) conn.close(); } catch (SQLException innerEx) { LOG.debug("Error cleaning up: " + innerEx); } } }
@Override public void delete(final String functionName, final String uniqueID) { PreparedStatement st = null; Connection conn = null; try { conn = connectionPool.getConnection(); if(conn != null) { st = conn.prepareStatement(deleteJobQuery); st.setString(1, functionName); st.setString(2, uniqueID); int deleted = st.executeUpdate(); LOG.debug("Deleted " + deleted + " records for " + functionName + "/" +uniqueID); } deleteCounter.inc(); pendingCounter.dec(); } catch (SQLException se) { LOG.error("SQL Error deleting job: " , se); } finally { try { if(st != null) st.close(); if(conn != null) conn.close(); } catch (SQLException innerEx) { LOG.debug("Error cleaning up: " + innerEx); } } }
conn = connectionPool.getConnection(); if (conn != null) {
conn = connectionPool.getConnection(); if(conn != null)
conn = connectionPool.getConnection(); if(conn != null)
conn = connectionPool.getConnection(); if(conn != null)
Statement stmt = null; try { connection = connectionPool.getConnection(); // fetch a connection stmt = connection.createStatement(); QueryResult result = null;
final Connection connection = connectionPool.getConnection(); ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
/** * {@inheritDoc} * * @see javax.sql.DataSource#getConnection() */ public Connection getConnection() throws SQLException { FinalWrapper<BoneCP> wrapper = this.pool; if (wrapper == null) { synchronized (this) { if (this.pool == null) { try{ if (this.getDriverClass() != null){ loadClass(this.getDriverClass()); } logger.debug(this.toString()); this.pool = new FinalWrapper<BoneCP>(new BoneCP(this)); } catch (ClassNotFoundException e) { throw new SQLException(PoolUtil.stringifyException(e)); } } wrapper = this.pool; } } return wrapper.value.getConnection(); }