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();

      }

}



Posted by 타다키치

댓글을 달아 주세요