/** * Returns a connection for caller to use. By default there's no connection pool associated with a connection * profile and this method just ignore the usePool parameter and delegates to {@link #createConnection(String, String)}. * Vendors who has the requirement to use connection pool may override this method. * @param databaseIdentifier the database identifier * @param usePool whether to retrieve the connection from connection pool. * @return a <code>Connection</code> instance * @throws SQLException if database error occurs */ public Connection createConnection(DatabaseIdentifier databaseIdentifier, boolean usePool) throws SQLException, NoSuchProfileException { return createConnection(databaseIdentifier.getProfileName(), databaseIdentifier.getDBname()); } /**
public static IConnectionInitializer getConnectionInitializer(DatabaseIdentifier databaseIdentifier) { ConnectionService service = getConnectionService(databaseIdentifier); if (service != null) { return service.getConnectionInitializer(); } return null; }
public static Runnable getConnectionKiller(DatabaseIdentifier databaseIdentifier, Connection conn) { ConnectionService service = getConnectionService(databaseIdentifier); if (service != null) { return service.getConnectionKiller(databaseIdentifier, conn); } return null; }
protected void initConnection(Connection connection) { //obtain the killer before execution to ensure we can get the connection id _connKiller = SQLToolsFacade.getConfiguration(null, _databaseIdentifier).getConnectionService().getConnectionKiller(_databaseIdentifier, connection); if (_needsInitConnection) { //MUST initialize this connection after getting the connection killer. IConnectionInitializer init = SQLToolsFacade.getConfiguration(null, _databaseIdentifier).getConnectionService().getConnectionInitializer(); if (init != null) { //if the configuration is null, will use the default options to initialize init.init(_databaseIdentifier, connection, getConfiguration()); } } }
Connection conn = conService.createConnection( _databaseIdentifier, true); if(conn == null) conService.closeConnection(getConnection(), _connid, _databaseIdentifier);
/** * Returns the connection service associated with this database definition * */ public ConnectionService getConnectionService() { return new ConnectionService(); }
public static int getConnectionId(DatabaseIdentifier databaseIdentifier, Connection conn) { if (databaseIdentifier == null || conn == null) { return 0; } try { if (conn.isClosed()) { return 0; } } catch (SQLException e) { EditorCorePlugin.getDefault().log(e); } ConnectionService service = getConnectionService(databaseIdentifier); return service.getConnectionId(databaseIdentifier, conn); }
con = conf.getConnectionService().createControlConnection(databaseIdentifier);
.getProfileName()); ConnectionService conService = f.getConnectionService(); conService.closeConnection(connection, _connid, _databaseIdentifier);
public Connection createConnection(String[] connId) throws SQLException, CoreException, NoSuchProfileException { // using connection pool for debugging may produce unexpected results SQLDevToolsConfiguration f = SQLToolsFacade .getConfigurationByProfileName(getDatabaseIdentifier() .getProfileName()); ConnectionService conService = f.getConnectionService(); Connection con = conService.createConnection(getDatabaseIdentifier() .getProfileName(), getDatabaseIdentifier().getDBname()); if (connId != null && connId.length == 1) { connId[0] = "0"; } return con; }
.getProfileName()); ConnectionService conService = f.getConnectionService(); debuggeeCon = conService.createConnection(controlCon .getDatabaseIdentifier().getProfileName(), controlCon .getDatabaseIdentifier().getDBname());
_conn = SQLToolsFacade.getConnectionService(getDatabaseIdentifier()).createConnection( getDatabaseIdentifier(), true);