package jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
public class ConnectTest {
public static void main(String[] args) throws Exception{
//Driver Loading
Class.forName("oracle.jdbc.OracleDriver");
String path = "jdbc:oracle:thin:@thinker.ipdisk.co.kr:1521:orcl";
String userid = "user00";
String userpw="user00";
Connection con = DriverManager.getConnection(path, userid, userpw);
System.out.println(con);
con.close();
}
}
------------------------------------------------------------------------------------------
package jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
public class ConnectTest implements Runnable{
public void run(){
try {
this.makeConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
public void makeConnection() throws Exception{
//Driver Loading
Class.forName("oracle.jdbc.OracleDriver");
String path = "jdbc:oracle:thin:@thinker.ipdisk.co.kr:1521:orcl";
String userid = "user00";
String userpw="user00";
Connection con = DriverManager.getConnection(path, userid, userpw);
System.out.println(con);
Thread.sleep(100);
con.close();
}
public static void main(String[] args) throws Exception {
ConnectTest obj = new ConnectTest();
for (int i = 0; i < 50; i++) {
Thread th = new Thread(obj);
th.start();
}
}
}
'코딩 > Oracle' 카테고리의 다른 글
Oracle SQL - Toy Data 데이터 만들기 (0) | 2014.09.13 |
---|---|
JDBC 연결 예제 3 - Try ~ With (0) | 2014.09.13 |
JDBC 연결 예제 1 - Template Method Pattern (0) | 2014.09.13 |
Oracle SQL - table, sequence 생성과 데이터 insert 예제 (0) | 2014.09.13 |
Oracle SQL - 4지선다 문제 Decode 예제 (0) | 2014.09.13 |