Java JDBC Oracle Connection getConnection()

Here you can find the source of getConnection()

Description

get Connection

License

Open Source License

Declaration

public static Connection getConnection() 

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() {
        Connection con = null;// w  ww .  j av a2 s  . co m
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
        } catch (ClassNotFoundException e) {
            //LOG to be written
            e.printStackTrace();
        }
        try {
            con = DriverManager.getConnection("jdbc:oracle:thin:@hstslc015:1521:elp", "", "");
        } catch (Exception e) {
            //LOG to be written
            e.printStackTrace();
        }
        return con;
    }
}

Related

  1. getConnection()
  2. getConnection()
  3. getConnection()
  4. getConnection()
  5. getConnection()
  6. getConnection()
  7. getConnection(String connectString)
  8. getConnection(String dbType, String dbIp, String dbPort, String dbName, String userName, String password)
  9. getConnection(String ip, String serviceName, String uid, String pwd)