Java JDBC Connection Create getConnections(String driver, String url, String user, String pwd)

Here you can find the source of getConnections(String driver, String url, String user, String pwd)

Description

get Connections

License

Apache License

Declaration

private static Connection getConnections(String driver, String url, String user, String pwd) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Connection;

import java.sql.DriverManager;

import java.util.Properties;

public class Main {
    private static Connection getConnections(String driver, String url, String user, String pwd) throws Exception {
        Connection conn = null;/* ww  w .j  ava 2  s  .c  o  m*/
        try {
            Properties props = new Properties();
            props.put("remarksReporting", "true");
            props.put("user", user);
            props.put("password", pwd);
            Class.forName(driver);
            conn = DriverManager.getConnection(url, props);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
        return conn;
    }
}

Related

  1. getConnection(String url, String username, String password)
  2. getConnection(String url, String userName, String password)
  3. getConnection(String url, String username, String password)
  4. getConnection(String username, String password, String driver, String url)
  5. getConnection2()
  6. getConnectionWithTransaction(String dbUrl, String dbUser, String dbPassword)
  7. getDBConnection()
  8. getJdbcOdbcConnection()
  9. getNewConnection()