Package java.sql

Examples of java.sql.Driver.connect()


            if(data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
            } finally {
                if(con != null) try{con.close();}catch(SQLException e) {}
            }
View Full Code Here


    // get actual URL that the real driver expects
    // (strip off "jdbc:log4" from url)
    url = url.substring(9);

    lastUnderlyingDriverRequested = d;
    Connection c = d.connect(url, info);

    if (c == null)
    {
      throw new SQLException("invalid or unknown driver url: " + url);
    }
View Full Code Here

    String url = getUrl();
    Assert.notNull(driver, "Driver must not be null");
    if (logger.isDebugEnabled()) {
      logger.debug("Creating new JDBC Driver Connection to [" + url + "]");
    }
    return driver.connect(url, props);
  }

}
View Full Code Here

            if(data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
            } finally {
                if(con != null) try{con.close();}catch(SQLException e) {}
            }
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

            if(data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
            } finally {
                if(con != null) try{con.close();}catch(SQLException e) {}
            }
View Full Code Here

            if(data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
            } finally {
                if(con != null) try{con.close();}catch(SQLException e) {}
            }
View Full Code Here

            }
           
            // First connect to verify the database does not yet exist
            Connection con;
            try {
                con = driver.connect(jdbcPath, props);
                con.close();
                throw new WGInvalidDatabaseException("Cannot create database bc. it already exists");
            }
            catch (SQLException e) {
                if (e.getErrorCode() != 1049) {
View Full Code Here

            }
           
            // Connect to create
            props.setProperty("createDatabaseIfNotExist", "true");
            try {
                con = driver.connect(jdbcPath, props);
            }
            catch (SQLException e) {
                throw new WGInvalidDatabaseException("Cannot create database bc. of exception on creation: " + e.getClass().getName() + " - " + e.getMessage());
            }
           
View Full Code Here

            }
            else {
                props.put("password", "");
            }
           
            Connection con = driver.connect(jdbcPath, props);
            Statement showDbsStmt = null;
            try {
               showDbsStmt = con.createStatement();
               showDbsStmt.execute("show databases");
               ResultSet dbRS = showDbsStmt.getResultSet();
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.