Java JDBC Connection Create getConnection(String subprotocol, String subname, String user, String password)

Here you can find the source of getConnection(String subprotocol, String subname, String user, String password)

Description

get Connection

License

Open Source License

Declaration

public static Connection getConnection(String subprotocol, String subname, String user, String password) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;

import java.sql.DriverManager;

public class Main {
    public static Connection getConnection(String subprotocol, String subname, String user, String password) {
        Connection conn = null;/*from w ww  .jav a2s.  co m*/
        String conDetails = "jdbc:" + subprotocol + ":" + subname + "?user=" + user + "&password=" + password;
        try {
            conn = DriverManager.getConnection(conDetails);
        } catch (Exception e) {

        }
        return conn;
    }
}

Related

  1. getConnection(String driverName, String urlprefix, String host, String port, String database, String user, String password)
  2. getConnection(String drvr, String url, String nm, String pass)
  3. getConnection(String filename)
  4. getConnection(String jdbcDriverName, String connectionURL)
  5. getConnection(String propertiesFilePath)
  6. getConnection(String url, String username, String password)
  7. getConnection(String url, String userName, String password)
  8. getConnection(String url, String username, String password)
  9. getConnection(String username, String password, String driver, String url)