Here you can find the source of createConnection()
public static Connection createConnection() throws SQLException, ClassNotFoundException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class Main { private static Properties properties; public static Connection createConnection() throws SQLException, ClassNotFoundException { String host = properties.getProperty("hostname"); String port = properties.getProperty("port"); String sid = properties.getProperty("sid"); String username = properties.getProperty("username"); String password = properties.getProperty("password"); String url = "jdbc:oracle:thin:@" + host + ":" + port + ":" + sid; Class.forName("oracle.jdbc.driver.OracleDriver"); return DriverManager.getConnection(url, username, password); }/*from w w w .j av a2 s . c om*/ }