Here you can find the source of getJDBCConn(String hostname, String port, String sid, String username, String pwd)
Parameter | Description |
---|---|
hostname | a parameter |
port | a parameter |
sid | a parameter |
username | a parameter |
pwd | a parameter |
public static Connection getJDBCConn(String hostname, String port, String sid, String username, String pwd) throws ClassNotFoundException, SQLException
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { /**//from w ww .j a v a 2 s . c o m * create by David.ze 2015/07/11 * Class.forName("oracle.jdbc.driver.OracleDriver"); * @param hostname * @param port * @param sid * @param username * @param pwd * @return */ public static Connection getJDBCConn(String hostname, String port, String sid, String username, String pwd) throws ClassNotFoundException, SQLException { Connection conn = null; Class.forName("oracle.jdbc.driver.OracleDriver"); String thinLink = "jdbc:oracle:thin:@" + hostname + ":" + port + ":" + sid; conn = DriverManager.getConnection(thinLink, username, pwd); return conn; } }