Java Code Examples for org.apache.phoenix.jdbc.PhoenixTestDriver#connect()

The following examples show how to use org.apache.phoenix.jdbc.PhoenixTestDriver#connect() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: phoenix   File: BaseTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link PhoenixTestDriver} and register it.
 * @return an initialized and registered {@link PhoenixTestDriver} 
 */
protected static PhoenixTestDriver initAndRegisterDriver(String url, ReadOnlyProps props) throws Exception {
    PhoenixTestDriver newDriver = new PhoenixTestDriver(props);
    DriverManager.registerDriver(newDriver);
    Driver oldDriver = DriverManager.getDriver(url); 
    if (oldDriver != newDriver) {
        destroyDriver(oldDriver);
    }
    Connection conn = newDriver.connect(url, PropertiesUtil.deepCopy(TEST_PROPERTIES));
    conn.close();
    return newDriver;
}
 
Example 2
Source Project: phoenix   File: BaseTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link PhoenixTestDriver} and register it.
 * @return an initialized and registered {@link PhoenixTestDriver} 
 */
public static PhoenixTestDriver initAndRegisterTestDriver(String url, ReadOnlyProps props) throws Exception {
    PhoenixTestDriver newDriver = newTestDriver(props);
    DriverManager.registerDriver(newDriver);
    Driver oldDriver = DriverManager.getDriver(url); 
    if (oldDriver != newDriver) {
        destroyDriver(oldDriver);
    }
    Properties driverProps = PropertiesUtil.deepCopy(TEST_PROPERTIES);
    Connection conn = newDriver.connect(url, driverProps);
    conn.close();
    return newDriver;
}