List of usage examples for java.sql Connection setCatalog
void setCatalog(String catalog) throws SQLException;
Connection
object's database in which to work. From source file:org.verdictdb.core.scramblingquerying.TpchScrambleQueryForAllDatabasesTest.java
private static Connection setupMysql() throws SQLException, VerdictDBDbmsException { String mysqlConnectionString = String.format("jdbc:mysql://%s?autoReconnect=true&useSSL=false", MYSQL_HOST); String vcMysqlConnectionString = String.format( "jdbc:verdict:mysql://%s?autoReconnect=true&useSSL=false&" + "verdictdbmetaschema=%s&verdictdbtempschema=%s", MYSQL_HOST, VERDICT_META_SCHEMA, VERDICT_TEMP_SCHEMA); Connection conn = DatabaseConnectionHelpers.setupMySql(mysqlConnectionString, MYSQL_USER, MYSQL_PASSWORD, SCHEMA_NAME);//from www . j a va 2 s . com Connection vc = DriverManager.getConnection(vcMysqlConnectionString, MYSQL_USER, MYSQL_PASSWORD); conn.setCatalog(SCHEMA_NAME); vc.setCatalog(SCHEMA_NAME); connMap.put("mysql", conn); vcMap.put("mysql", vc); schemaMap.put("mysql", MYSQL_DATABASE + "."); conn.createStatement() .execute(String.format("CREATE SCHEMA IF NOT EXISTS %s", options.getVerdictTempSchemaName())); vc.createStatement().execute( String.format("CREATE SCRAMBLE %s.lineitem_scramble FROM %s.lineitem", SCHEMA_NAME, SCHEMA_NAME)); return conn; }