Package java.sql

Examples of java.sql.Driver.connect()


        boolean expectUrlEqualsGetUrl, String url, Properties info)
    throws SQLException
    {
        Driver driver = DriverManager.getDriver(url);

        Connection conn = driver.connect(url, info);
        assertNotNull(conn);
  
        if (expectUrlEqualsGetUrl)
            assertEquals(url, conn.getMetaData().getURL());
        else
View Full Code Here


     */
    private static void shutdownDB(String url, Properties info) throws SQLException {
       
        Driver driver = DriverManager.getDriver(url);
        try {
            driver.connect(url, info);
        } catch (SQLException se) {
            assertSQLState("08006", se);
        }
    }

View Full Code Here

            driver.acceptsURL( null );
            fail( "Should not have accepted a null connection url" );
        }
        catch (SQLException se) { assertSQLState( MALFORMED_URL, se ); }
        try {
            driver.connect( null, props );
            fail( "Should not have accepted a null connection url" );
        }
        catch (SQLException se) { assertSQLState( MALFORMED_URL, se ); }
       
        conn.close();
View Full Code Here

            String url = clientCreateUrls[i];
            try{
                if (url.equals(CLIENT_CREATE_URL_WITH_COLON1))
                {
                    Driver driver = DriverManager.getDriver(url);
                    assertNull(driver.connect(url,info));
                }
                else
                    assertConnect(true, url, info);
            }
            catch(SQLException se){
View Full Code Here

        boolean expectUrlEqualsGetUrl, String url, Properties info)
    throws SQLException
    {
        Driver driver = DriverManager.getDriver(url);

        Connection conn = driver.connect(url, info);
        assertNotNull(conn);
  
        if (expectUrlEqualsGetUrl)
            assertEquals(url, conn.getMetaData().getURL());
        else
View Full Code Here

     */
    private static void shutdownDB(String url, Properties info) throws SQLException {
       
        Driver driver = DriverManager.getDriver(url);
        try {
            driver.connect(url, info);
        } catch (SQLException se) {
            assertSQLState("08006", se);
        }
    }

View Full Code Here

               if (userPassword.hasValue())
                  properties.setProperty("password", userPassword.getValue());
               try
               {
                  Driver driver = (Driver) driverClass.getValue().newInstance();
                  try (Connection connection = driver.connect(jdbcUrl.getValue(), properties))
                  {
                     context.addValidationInformation(verifyConnection, "Connection successful.");
                  }
                  finally
                  {
View Full Code Here

            Class<?> driverClazz = ClassLoaderUtils.loadClass(driverClassName);
            Driver driver = (Driver) driverClazz.newInstance();
            Properties props = new Properties();
            if (user != null) props.setProperty("user", user);
            if (password != null) props.setProperty("password", password);
            Connection connection = driver.connect(url, props);
            XAConnection xaConnection = JdbcProxyFactory.INSTANCE.getProxyXaConnection(connection);
            return xaConnection;
        } catch (Exception ex) {
            throw (SQLException) new SQLException("unable to connect to non-XA resource " + driverClassName).initCause(ex);
        }
View Full Code Here

            Class<?> driverClazz = ClassLoaderUtils.loadClass(driverClassName);
            Driver driver = (Driver) driverClazz.newInstance();
            Properties props = new Properties();
            props.setProperty("user", user);
            props.setProperty("password", password);
            Connection connection = driver.connect(url, props);
            XAConnection xaConnection = JdbcProxyFactory.INSTANCE.getProxyXaConnection(connection);
            return xaConnection;
        } catch (Exception ex) {
            throw (SQLException) new SQLException("unable to connect to non-XA resource " + driverClassName).initCause(ex);
        }
View Full Code Here

               if (userPassword.hasValue())
                  properties.setProperty("password", userPassword.getValue());
               try
               {
                  Driver driver = (Driver) driverClass.getValue().newInstance();
                  try (Connection connection = driver.connect(jdbcUrl.getValue(), properties))
                  {
                     if (connection == null)
                        throw new RuntimeException("JDBC URL [" + jdbcUrl.getValue()
                                 + "] is not compatible with the selected driver [" + driverClass.getValue().getName()
                                 + "].");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.