Examples of acceptsURL()


Examples of java.sql.Driver.acceptsURL()

    }

    private static String attemptConnect(PortletRequest request, PoolData data) throws SQLException, IllegalAccessException, InstantiationException {
        Class driverClass = attemptDriverLoad(request, data);
        Driver driver = (Driver) driverClass.newInstance();
        if (driver.acceptsURL(data.url)) {
            Properties props = new Properties();
            if (data.user != null) {
                props.put("user", data.user);
            }
            if (data.password != null) {
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

    Mockito.when( mockDriver.connect( url, new Properties() ) ).thenReturn( mockConn );
    Mockito.when( mockDriver.acceptsURL( url ) ).thenReturn( true );
    Mockito.when( mockDriver.connect( url2, new Properties() ) ).thenReturn( null );
    Mockito.when( mockDriver.acceptsURL( url2 ) ).thenReturn( false );
    Mockito.when( mockDriver2.connect( url, new Properties() ) ).thenReturn( null );
    Mockito.when( mockDriver2.acceptsURL( url ) ).thenReturn( false );
    Mockito.when( mockDriver2.connect( url2, new Properties() ) ).thenReturn( mockConn2 );
    Mockito.when( mockDriver2.acceptsURL( url2 ) ).thenReturn( true );
    Connection conn = DriverManager.getConnection( url );
    Assert.assertSame( mockConn, conn );
    Connection conn2 = DriverManager.getConnection( url2 );
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

    Mockito.when( mockDriver.connect( url2, new Properties() ) ).thenReturn( null );
    Mockito.when( mockDriver.acceptsURL( url2 ) ).thenReturn( false );
    Mockito.when( mockDriver2.connect( url, new Properties() ) ).thenReturn( null );
    Mockito.when( mockDriver2.acceptsURL( url ) ).thenReturn( false );
    Mockito.when( mockDriver2.connect( url2, new Properties() ) ).thenReturn( mockConn2 );
    Mockito.when( mockDriver2.acceptsURL( url2 ) ).thenReturn( true );
    Connection conn = DriverManager.getConnection( url );
    Assert.assertSame( mockConn, conn );
    Connection conn2 = DriverManager.getConnection( url2 );
    Assert.assertSame( mockConn2, conn2 );
    DriverManager.deregisterDriver( driver );
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

    };
    DriverManager.registerDriver( driver );
    String url = "jdbc:driver4:morestuff";
    String url2 = "jdbc:driver1:morestuff";
    Mockito.when( mockDriver.connect( url2, new Properties() ) ).thenReturn( mockConn );
    Mockito.when( mockDriver.acceptsURL( url2 ) ).thenReturn( true );
    Connection conn = DriverManager.getConnection( url );
    Assert.assertSame( mockConn, conn );
    DriverManager.deregisterDriver( driver );
  }
}
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

        for (int u = 0; u < urls.length;u++)
        {
            String url = urls[u];
            boolean expectedAcceptance = acceptsURLTable[u][frameworkOffset];
            boolean actualAcceptance = driver.acceptsURL(url);
            assertEquals(expectedAcceptance, actualAcceptance);
        }
    }
   
    /**
 
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

  private Driver findRegisteredDriver(String url) {
    for (Enumeration drivers = DriverManager.getDrivers(); drivers != null
        && drivers.hasMoreElements();) {
      Driver driver = (Driver) drivers.nextElement();
      try {
        if (driver.acceptsURL(url)) {
          return driver;
        }
      } catch (Exception e) {
      }
    }
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

        for (int u = 0; u < urls.length;u++)
        {
            String url = urls[u];
            boolean expectedAcceptance = acceptsURLTable[u][frameworkOffset];
            boolean actualAcceptance = driver.acceptsURL(url);
            assertEquals(expectedAcceptance, actualAcceptance);
        }
    }
   
    /**
 
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

                } else {
                    // Usage of DriverManager is not possible, as it does not
                    // respect the ContextClassLoader
                    // N.B. This cast may cause ClassCastException which is handled below
                    driverToUse = (Driver) driverFromCCL.newInstance();
                    if (!driverToUse.acceptsURL(url)) {
                        throw new SQLException("No suitable driver", "08001");
                    }
                }
            } catch (Exception t) {
                String message = "Cannot create JDBC driver of class '" +
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

    }

    private static String attemptConnect(PortletRequest request, PoolData data) throws SQLException, IllegalAccessException, InstantiationException {
        Class driverClass = attemptDriverLoad(request, data);
        Driver driver = (Driver) driverClass.newInstance();
        if (driver.acceptsURL(data.url)) {
            Properties props = new Properties();
            if (data.user != null) {
                props.put("user", data.user);
            }
            if (data.password != null) {
View Full Code Here

Examples of java.sql.Driver.acceptsURL()

                } else {
                    // Usage of DriverManager is not possible, as it does not
                    // respect the ContextClassLoader
                    // N.B. This cast may cause ClassCastException which is handled below
                    driverToUse = (Driver) driverFromCCL.newInstance();
                    if (!driverToUse.acceptsURL(url)) {
                        throw new SQLException("No suitable driver", "08001");
                    }
                }
            } catch (Exception t) {
                String message = "Cannot create JDBC driver of class '" +
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.