Here you can find the source of getOracle10GConnection(String connIP, String port, String dbName, String username, String password)
private static Connection getOracle10GConnection(String connIP, String port, String dbName, String username, String password)
//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; } }