@Override public void setCatalog(String catalog) throws SQLException { targetConnection.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { raw.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { raw.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { connection.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { delegate.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { connection.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { delegate.setCatalog(catalog); }
private void trySetConnectionProperties(Query query, Connection connection) throws SQLException { // Required for jdbc drivers that do not implement all/some of these functions (eg. impala jdbc driver) // For these drivers, set the database default values in the query database try { connection.setClientInfo("ApplicationName", "verifier-rewrite"); connection.setCatalog(catalogOverride.orElse(query.getCatalog())); connection.setSchema(schemaOverride.orElse(query.getSchema())); } catch (SQLClientInfoException ignored) { // Do nothing } }
/** {@inheritDoc} */ @Override public void setCatalog(String catalog) throws SQLException { conn.setCatalog(catalog); }
/** * Build properties for the Driver, including the given username and password (if any), * and obtain a corresponding Connection. * @param username the name of the user * @param password the password to use * @return the obtained Connection * @throws SQLException in case of failure * @see java.sql.Driver#connect(String, java.util.Properties) */ protected Connection getConnectionFromDriver(@Nullable String username, @Nullable String password) throws SQLException { Properties mergedProps = new Properties(); Properties connProps = getConnectionProperties(); if (connProps != null) { mergedProps.putAll(connProps); } if (username != null) { mergedProps.setProperty("user", username); } if (password != null) { mergedProps.setProperty("password", password); } Connection con = getConnectionFromDriver(mergedProps); if (this.catalog != null) { con.setCatalog(this.catalog); } if (this.schema != null) { con.setSchema(this.schema); } return con; }
/** * Determine whether there are currently thread-bound credentials, * using them if available, falling back to the statically specified * username and password (i.e. values of the bean properties) otherwise. * <p>Delegates to {@link #doGetConnection(String, String)} with the * determined credentials as parameters. * @see #doGetConnection */ @Override public Connection getConnection() throws SQLException { JdbcUserCredentials threadCredentials = this.threadBoundCredentials.get(); Connection con = (threadCredentials != null ? doGetConnection(threadCredentials.username, threadCredentials.password) : doGetConnection(this.username, this.password)); if (this.catalog != null) { con.setCatalog(this.catalog); } if (this.schema != null) { con.setSchema(this.schema); } return con; }
@Override public void setCatalog(String catalog) throws SQLException { _baseConn.setCatalog(catalog); }
@Override public void run() throws Exception { conn.setCatalog(""); } });
@Override public void setCatalog(String catalog) throws SQLException { blockUntilAvailable(); connection.setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { checkState(); try { conn.setCatalog(catalog); } catch (SQLException ex) { handleException(ex, null); } }
private void trySetConnectionProperties(Query query, Connection connection) throws SQLException { // Required for jdbc drivers that do not implement all/some of these functions (eg. impala jdbc driver) // For these drivers, set the database default values in the query database try { connection.setClientInfo("ApplicationName", "verifier-test:" + queryPair.getName()); connection.setCatalog(query.getCatalog()); connection.setSchema(query.getSchema()); } catch (SQLClientInfoException ignored) { // Do nothing } }
@Override public void connection_setCatalog(ConnectionProxy connection, String catalog) throws SQLException { if (this.pos < filterSize) { nextFilter() .connection_setCatalog(this, connection, catalog); return; } connection.getRawObject() .setCatalog(catalog); }
@Override public void setCatalog(String catalog) throws SQLException { TestObjectStoreInitRetry.debugTrace(); _baseConn.setCatalog(catalog); }
@Test(groups = JDBC) @Requires(ImmutableNationTable.class) public void shouldExecuteQueryWithSelectedCatalogAndSchema() throws SQLException { if (usingTeradataJdbc4Driver(connection())) { LOGGER.warn("connection().setSchema() is not supported in JDBC 4"); } else { connection().setCatalog("hive"); connection().setSchema("default"); try (Statement statement = connection().createStatement()) { QueryResult result = queryResult(statement, "select * from nation"); assertThat(result).matches(PRESTO_NATION_RESULT); } } }
public Session openSession(CommandContext commandContext) { DbSqlSession dbSqlSession = new DbSqlSession(this, commandContext.getEntityCache()); if (getDatabaseSchema() != null && getDatabaseSchema().length() > 0) { try { dbSqlSession.getSqlSession().getConnection().setSchema(getDatabaseSchema()); } catch (SQLException e) { throw new ActivitiException("Could not set database schema on connection", e); } } if (getDatabaseCatalog() != null && getDatabaseCatalog().length() > 0) { try { dbSqlSession.getSqlSession().getConnection().setCatalog(getDatabaseCatalog()); } catch (SQLException e) { throw new ActivitiException("Could not set database catalog on connection", e); } } return dbSqlSession; }