/** * Gets a connection which may be pooled by the app server or middleware implementation of * DataSource. * * @throws java.sql.SQLException Occurs when the physical database connection cannot be * established. */ public PooledConnection getPooledConnection() throws SQLException { return new PGPooledConnection(getConnection(), defaultAutoCommit); }
/** * XAConnection interface. */ @Override public Connection getConnection() throws SQLException { Connection conn = super.getConnection(); // When we're outside an XA transaction, autocommit // is supposed to be true, per usual JDBC convention. // When an XA transaction is in progress, it should be // false. if (state == State.IDLE) { conn.setAutoCommit(true); } /* * Wrap the connection in a proxy to forbid application from fiddling with transaction state * directly during an XA transaction */ ConnectionHandler handler = new ConnectionHandler(conn); return (Connection) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Connection.class, PGConnection.class}, handler); }
try pci.close(); pci.removeConnectionEventListener(connectionEventListener); try pci.close();
/** * Fires a connection error event, but only if we think the exception is fatal. * * @param e the SQLException to consider */ private void fireConnectionError(SQLException e) { if (!isFatalState(e.getSQLState())) { return; } fireConnectionFatalError(e); }
/** * Used to fire a connection closed event to all listeners. */ void fireConnectionClosed() { ConnectionEvent evt = null; // Copy the listener list so the listener can remove itself during this method call ConnectionEventListener[] local = listeners.toArray(new ConnectionEventListener[listeners.size()]); for (ConnectionEventListener listener : local) { if (evt == null) { evt = createConnectionEvent(null); } listener.connectionClosed(evt); } }
this.proxy = null; last = null; fireConnectionClosed(); if (ex != null) { throw ex;
new PSQLException(GT.tr("This PooledConnection has already been closed."), PSQLState.CONNECTION_DOES_NOT_EXIST); fireConnectionFatalError(sqlException); throw sqlException; fireConnectionFatalError(sqlException); throw (SQLException) sqlException.fillInStackTrace();
/** * Used to fire a connection error event to all listeners. */ void fireConnectionFatalError(SQLException e) { ConnectionEvent evt = null; // Copy the listener list so the listener can remove itself during this method call ConnectionEventListener[] local = listeners.toArray(new ConnectionEventListener[listeners.size()]); for (ConnectionEventListener listener : local) { if (evt == null) { evt = createConnectionEvent(e); } listener.connectionErrorOccurred(evt); } }
/** * Gets a connection which may be pooled by the app server or middleware implementation of * DataSource. * * @throws java.sql.SQLException Occurs when the physical database connection cannot be * established. */ public PooledConnection getPooledConnection(String user, String password) throws SQLException { return new PGPooledConnection(getConnection(user, password), defaultAutoCommit); }
try pci.close(); pci.removeConnectionEventListener(connectionEventListener); try pci.close();
/**** XAConnection interface ****/ public Connection getConnection() throws SQLException { if (logger.logDebug()) debug("PGXAConnection.getConnection called"); Connection conn = super.getConnection(); // When we're outside an XA transaction, autocommit // is supposed to be true, per usual JDBC convention. // When an XA transaction is in progress, it should be // false. if(state == STATE_IDLE) conn.setAutoCommit(true); /* * Wrap the connection in a proxy to forbid application from * fiddling with transaction state directly during an XA transaction */ ConnectionHandler handler = new ConnectionHandler(conn); return (Connection)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Connection.class, PGConnection.class}, handler); }
/** * Gets a connection which may be pooled by the app server or middleware * implementation of DataSource. * * @throws java.sql.SQLException * Occurs when the physical database connection cannot be established. */ public PooledConnection getPooledConnection(String user, String password) throws SQLException { return new PGPooledConnection(getConnection(user, password), defaultAutoCommit); }
try pci.close(); pci.removeConnectionEventListener(connectionEventListener); try pci.close();
/**** XAConnection interface ****/ public Connection getConnection() throws SQLException { if (logger.logDebug()) debug("PGXAConnection.getConnection called"); Connection conn = super.getConnection(); // When we're outside an XA transaction, autocommit // is supposed to be true, per usual JDBC convention. // When an XA transaction is in progress, it should be // false. if(state == STATE_IDLE) conn.setAutoCommit(true); return conn; }
/** * Gets a connection which may be pooled by the app server or middleware * implementation of DataSource. * * @throws java.sql.SQLException * Occurs when the physical database connection cannot be established. */ public PooledConnection getPooledConnection() throws SQLException { return new PGPooledConnection(getConnection(), defaultAutoCommit); }
/**** XAConnection interface ****/ public Connection getConnection() throws SQLException { if (logger.logDebug()) debug("PGXAConnection.getConnection called"); Connection conn = super.getConnection(); // When we're outside an XA transaction, autocommit // is supposed to be true, per usual JDBC convention. // When an XA transaction is in progress, it should be // false. if(state == STATE_IDLE) conn.setAutoCommit(true); /* * Wrap the connection in a proxy to forbid application from * fiddling with transaction state directly during an XA transaction */ ConnectionHandler handler = new ConnectionHandler(conn); return (Connection)Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Connection.class, PGConnection.class}, handler); }
/** * Gets a connection which may be pooled by the app server or middleware * implementation of DataSource. * * @throws java.sql.SQLException * Occurs when the physical database connection cannot be established. */ public PooledConnection getPooledConnection() throws SQLException { return new PGPooledConnection(getConnection(), defaultAutoCommit); }
/** * Gets a connection which may be pooled by the app server or middleware * implementation of DataSource. * * @throws java.sql.SQLException * Occurs when the physical database connection cannot be established. */ public PooledConnection getPooledConnection(String user, String password) throws SQLException { return new PGPooledConnection(getConnection(user, password), defaultAutoCommit); }
/** * Gets a connection which may be pooled by the app server or middleware * implementation of DataSource. * * @throws java.sql.SQLException * Occurs when the physical database connection cannot be established. */ public PooledConnection getPooledConnection() throws SQLException { return new PGPooledConnection(getConnection(), defaultAutoCommit); }
/** * Gets a connection which may be pooled by the app server or middleware * implementation of DataSource. * * @throws java.sql.SQLException * Occurs when the physical database connection cannot be established. */ public PooledConnection getPooledConnection(String user, String password) throws SQLException { return new PGPooledConnection(getConnection(user, password), defaultAutoCommit); }