Package java.sql

Examples of java.sql.Driver.connect()


       Connection con = null;
     try
     {
       String url = getConnectionURL();
       Driver d = getDriver(url);
       con = d.connect(url, copy);
       if (con == null)
         throw new JBossResourceException("Wrong driver class for this connection URL");

       return new LocalManagedConnection(this, con, props, transactionIsolation, preparedStatementCacheSize);
     }
View Full Code Here


        }
       Connection con = null;
         try
         {
           Driver d = getDriver(url);
           con = d.connect(url, copy);
           if(con == null)
           {
             log.warn("Wrong driver class for this connection URL: " + url);
         urlSelector.failedUrlObject(url);
           }
View Full Code Here

   */
  public static Statement open(String driverklass, String jdbcuri,
                               Properties props) {
    try {
      Driver driver = (Driver) ObjectUtils.instantiate(driverklass);
      Connection conn = driver.connect(jdbcuri, props);
      if (conn == null)
        throw new DukeException("Couldn't connect to database at " +
                                   jdbcuri);
      return conn.createStatement();

View Full Code Here

      props.setProperty("remarksReporting", "true"); //$NON-NLS-1$
    }

    props.putAll(config.getProperties());

    Connection conn = driver.connect(config.getConnectionURL(), props);

    if (conn == null) {
      throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$
    }
View Full Code Here

            String conStr = "jdbc:derby:"+dbname+";"+
                Attribute.REPLICATION_INTERNAL_SHUTDOWN_SLAVE+
                "=true";

            embedDriver.connect(conStr, (Properties) null);
        } catch (Exception e) {
            // Todo: report error to derby.log if exception is not
            // SQLState.SHUTDOWN_DATABASE
        }
    }
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

            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

        // Fire up Derby to get the version string.
        Class driverClass =
                Class.forName("org.apache.derby.jdbc.EmbeddedDriver", true, cl);
        Driver driver = (Driver)driverClass.newInstance();
        Connection con = driver.connect(JDBC_URL, null);
        DatabaseMetaData meta = con.getMetaData();
        con.close();
        // Delete the derby.log file.
        new File("derby.log").delete();
View Full Code Here

       
        // Create the data source and initialize the database tables
        Driver hsqlDriver = (Driver) Class.forName("org.hsqldb.jdbcDriver").newInstance();
        Properties info = new Properties();
        info.put("shutdown", true);
        Connection conn = hsqlDriver.connect("jdbc:hsqldb:mem:sqltest", info);
//        Connection conn = DriverManager.getConnection("jdbc:hsqldb:mem:sqltest");
        conn.createStatement().execute("CREATE TABLE users (user VARCHAR(255), password VARCHAR(255))");
        conn.createStatement().execute("CREATE TABLE groups (grp VARCHAR(255), user VARCHAR(255))");

        // Add users
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.