Package java.sql

Examples of java.sql.Driver


        stat.execute("DROP TABLE IF EXISTS TEST_TEMP");
        conn.close();
    }

    private void testStatic() throws SQLException {
        Driver dr = org.h2.Driver.load();

        assertEquals(dr.getMajorVersion(), meta.getDriverMajorVersion());
        assertEquals(dr.getMinorVersion(), meta.getDriverMinorVersion());
        assertTrue(dr.jdbcCompliant());

        assertEquals(0, dr.getPropertyInfo(null, null).length);
        assertTrue(dr.connect("jdbc:test:false", null) == null);

        assertTrue(meta.getNumericFunctions().length() > 0);
        assertTrue(meta.getStringFunctions().length() > 0);
        assertTrue(meta.getSystemFunctions().length() > 0);
        assertTrue(meta.getTimeDateFunctions().length() > 0);
View Full Code Here


     * This method is called using reflection.
     */
    static void runTest() throws Exception {
        Class.forName("org.h2.Driver");
        Class.forName("org.h2.upgrade.v1_1.Driver");
        Driver d1 = DriverManager.getDriver("jdbc:h2:mem:test");
        Driver d2 = DriverManager.getDriver("jdbc:h2v1_1:mem:test");
        Connection connection;
        connection = DriverManager.getConnection("jdbc:h2:mem:test");
        DriverManager.deregisterDriver(d1);
        DriverManager.deregisterDriver(d2);
        connection.close();
View Full Code Here

            driverClass = cl.loadClass("org.h2.Driver");
        } catch (ClassNotFoundException e) {
            return null;
        }
        Method m = driverClass.getMethod("load");
        Driver driver = (Driver) m.invoke(null);
        return driver;
    }
View Full Code Here

                DriverManager.getConnection("jdbc:derby:;shutdown=true");
            } catch (SQLException e) {
                // ignore
            }
            try {
                Driver driver = (Driver) Class.forName(DRIVER).newInstance();
                DriverManager.registerDriver(driver);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
View Full Code Here

     * @throws Exception
     */
    protected Connection getConnection()
        throws Exception
    {
        Driver driver = (Driver)ClassUtils.loadClass(this.jdbcDriver).newInstance();
        DriverManager.registerDriver(new JdbcDriverWrapper(driver));
        return DriverManager.getConnection(
            this.jdbcConnectionUrl,
            this.jdbcUsername,
            this.jdbcPassword);
View Full Code Here

    private static String registerWrapperForName(String userDriverClassName) {
        String wrapperDriverClassName = null;

        try {
            //look in the classpath for a custom driver that supports the requested driver
            Driver userDriver = findRegisteredUserDriver(userDriverClassName);

            if (userDriver == null) {
                //there is no registered user driver, try registering it now
                try {
                    Class.forName(userDriverClassName);
View Full Code Here

     * @return
     */
    public static Driver findRegisteredUserDriver(String userDriverClassName) {
        Enumeration en = DriverManager.getDrivers();
        while (en.hasMoreElements()) {
            Driver aDriver = (Driver) en.nextElement();
            if (aDriver.getClass().getName().equals(userDriverClassName)) {
                return aDriver;
            }
        }

        return null;
View Full Code Here

        }

        props.put("user", user);
        props.put("password", pw);

        Driver driverInst = (Driver) Class.forName(driver).newInstance();

        Connection jdbcConn = driverInst.connect(url, props);
        if (jdbcConn == null) {
            throw new RuntimeException("Connect failed");
        }

        return jdbcConn;
View Full Code Here

        }

        props.put("user", user);
        props.put("password", pw);

        Driver driverInst = (Driver) Class.forName(driver).newInstance();

        Connection jdbcConn = driverInst.connect(url, props);
        if (jdbcConn == null) {
            throw new RuntimeException("Connect failed");
        }

        return jdbcConn;
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception
  {
    Driver driver = (Driver) (Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
   
    String nullUrl = null;
    String emptyUrl = "";
    String oracleUrl = "jdbc:oracle:thin:@localhost:1521:orcl";
   
View Full Code Here

TOP

Related Classes of java.sql.Driver

Copyright © 2018 www.massapicom. 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.