Java JDBC Oracle Connection getOracle10GConnection(String connIP, String port, String dbName, String username, String password)

Here you can find the source of getOracle10GConnection(String connIP, String port, String dbName, String username, String password)

Description

get Oracle G Connection

License

Open Source License

Declaration

private static Connection getOracle10GConnection(String connIP, String port, String dbName, String username,
            String password) 

Method Source Code

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

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

public class Main {
    private static Connection getOracle10GConnection(String connIP, String port, String dbName, String username,
            String password) {/*from   w ww . j  a v a2 s .  co  m*/
        Connection conn = null;
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection(
                    "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" + "(HOST=" + connIP
                            + ")(PORT=" + port + ")))" + "(CONNECT_DATA=(SID=" + dbName + ")))",
                    username, password);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return conn;
    }
}

Related

  1. getConnection(String ip, String serviceName, String uid, String pwd)
  2. getDatabaseConnection()
  3. getDBVersion(String dbSourceName, String server, int port, String dbName, String userid, String pwd)
  4. getJDBCConn(String hostname, String port, String sid, String username, String pwd)
  5. getJDBCConnection()
  6. getOracleConn()
  7. getOracleConnection()
  8. getOracleDBConnection(String server, String database, String username, String password)
  9. GetSchemaList(String dbSourceName, String server, int port, String dbName, String userid, String pwd)