Java JDBC Connection Create createDbConnection(String dbUrl, String dbUser, String dbPass, String dbDriverClass)

Here you can find the source of createDbConnection(String dbUrl, String dbUser, String dbPass, String dbDriverClass)

Description

create Db Connection

License

Open Source License

Declaration

private static Connection createDbConnection(String dbUrl, String dbUser, String dbPass, String dbDriverClass)
            throws SQLException 

Method Source Code


//package com.java2s;

import java.sql.*;

public class Main {
    private static Connection createDbConnection(String dbUrl, String dbUser, String dbPass, String dbDriverClass)
            throws SQLException {
        try {//from  w  ww.j  a  va  2 s.  c o m
            Class.forName(dbDriverClass).newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

        return DriverManager.getConnection(dbUrl, dbUser, dbPass);
    }
}

Related

  1. canConnect(Properties dbSettings)
  2. clearTable(String tableName, String driver, String url, String user, String password)
  3. createConnection()
  4. createConnection(Properties props, String prefix)
  5. createDatabase(String dbConnectionString, String dbName, String user, String pass, String driver)
  6. getAccessConn(String path)
  7. getConnect(String driver, String url, String user, String password)
  8. getConnection()
  9. getConnection()