Java JDBC Connection Create getConnection()

Here you can find the source of getConnection()

Description

get Connection

License

Open Source License

Declaration

public static Connection getConnection() throws ClassNotFoundException, SQLException 

Method Source Code


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

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

public class Main {
    public static Connection getConnection() throws ClassNotFoundException, SQLException {
        ResourceBundle rb = ResourceBundle.getBundle("db");
        Class.forName(rb.getString("drivername"));
        Connection con = DriverManager.getConnection(rb.getString("dburl"), rb.getString("userid"),
                rb.getString("password"));
        return con;
    }/*from w  w w  .  j  a  v  a  2s . c  o m*/
}

Related

  1. createConnection(Properties props, String prefix)
  2. createDatabase(String dbConnectionString, String dbName, String user, String pass, String driver)
  3. createDbConnection(String dbUrl, String dbUser, String dbPass, String dbDriverClass)
  4. getAccessConn(String path)
  5. getConnect(String driver, String url, String user, String password)
  6. getConnection()
  7. getConnection()
  8. getConnection()
  9. getConnection()