@Override public void setSchema(String schema) throws SQLException { targetConnection.setSchema(schema); }
@Override public void setSchema(String schema) throws SQLException { raw.setSchema(schema); }
@Override public void setSchema(String schema) throws SQLException { connection.setSchema(schema); }
@Override public void setSchema(String schema) throws SQLException { raw.setSchema(schema); }
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 } }
/** * 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; }
/** * 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; }
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_setSchema(ConnectionProxy connection, String schema) throws SQLException { if (this.pos < filterSize) { nextFilter() .connection_setSchema(this, connection, schema); return; } connection.getRawObject() .setSchema(schema); }
/** * @return Connection without streaming initially turned on. * @throws SQLException if failed. */ protected Connection createOrdinaryConnection() throws SQLException { Connection res = DriverManager.getConnection(BASE_URL, new Properties()); res.setSchema(QueryUtils.DFLT_SCHEMA); return res; }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { conn = DriverManager.getConnection(URL); conn.setSchema('"' + DEFAULT_CACHE_NAME + '"'); assert conn != null; assert !conn.isClosed(); }
@Override public void run(Connection conn) throws Exception { conn.setSchema("PUBLIC"); try (Statement stmt = conn.createStatement()) { stmt.execute("CREATE TABLE cache_store_nulltest(id INT PRIMARY KEY, age INT NOT NULL) " + "WITH \"template=" + CACHE_STORE_TEMPLATE + "\""); } } }, "0A000",
@Override public void run(Connection conn) throws Exception { conn.setSchema("PUBLIC"); try (Statement stmt = conn.createStatement()) { stmt.execute("CREATE TABLE cache_interceptor_nulltest(id INT PRIMARY KEY, age INT NOT NULL) " + "WITH \"template=" + CACHE_INTERCEPTOR_TEMPLATE + "\""); } } }, "0A000", "NOT NULL constraint is not supported when CacheConfiguration.interceptor is set.");
@Override public void setSchema(String schema) throws SQLException { TestObjectStoreInitRetry.debugTrace(); _baseConn.setSchema(schema); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { Connection conn = DriverManager.getConnection(URL); conn.setSchema("\"pers\""); stmt = conn.createStatement(); assert stmt != null; assert !stmt.isClosed(); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { conn = DriverManager.getConnection(URL); conn.setSchema('"' + DEFAULT_CACHE_NAME + '"'); stmt = conn.createStatement(); assert stmt != null; assert !stmt.isClosed(); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { Connection conn = DriverManager.getConnection(URL); conn.setSchema('"' + DEFAULT_CACHE_NAME + '"'); stmt = conn.createStatement(); assert stmt != null; assert !stmt.isClosed(); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { Connection conn = DriverManager.getConnection(URL); conn.setSchema('"' + CACHE_NAME + '"'); stmt = conn.createStatement(); assert stmt != null; assert !stmt.isClosed(); }
@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); } } }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { ignite(0).getOrCreateCache(cacheConfig()); conn = createConnection(); conn.setSchema('"' + DEFAULT_CACHE_NAME + '"'); }