/** * Connect to the database. * Exceptions are caught and re-thrown as TopLink exceptions. * Must set the transaction isolation. */ protected void connect(Login login) throws DatabaseException { super.connect(login); checkTransactionIsolation(); }
/** * Attempt to save some of the cost associated with getting a fresh connection. * Assume the DatabaseDriver has been cached, if appropriate. * Note: Connections that are participating in transactions will not be refreshd.^M */ protected void reconnect(AbstractSession session) throws DatabaseException { session.log(SessionLog.FINEST, SessionLog.CONNECTION, "reconnecting_to_external_connection_pool"); session.startOperationProfile(SessionProfiler.CONNECT); connect(getLogin()); session.endOperationProfile(SessionProfiler.CONNECT); }
/** * Connect to the datasource. Through using a CCI ConnectionFactory. * Catch exceptions and re-throw as TopLink exceptions. */ public void connect(Login login, AbstractSession session) throws DatabaseException { session.startOperationProfile(SessionProfiler.CONNECT); session.incrementProfile(SessionProfiler.TlConnects); try { if (session.shouldLog(SessionLog.CONFIG, SessionLog.CONNECTION)) {// Avoid printing if no logging required. session.log(SessionLog.CONFIG, SessionLog.CONNECTION, "connecting", new Object[] { login }, this); } setLogin(login); this.setDatasourcePlatform((DatasourcePlatform)session.getDatasourceLogin().getDatasourcePlatform()); try { connect(login); setIsInTransaction(false); } catch (RuntimeException exception) { session.handleSevere(exception); } session.getEventManager().postConnect(this); incrementCallCount(session); try { buildConnectLog(session); } finally { decrementCallCount(); } } finally { session.endOperationProfile(SessionProfiler.CONNECT); } }