본문 바로가기

Oracle

오라클 커넥션풀 만들기 (기본)


포트번호 : 1521

SID명 : ORCL

ID/PW : scott/tiger

IP : localhost(or 127.0.0.1)

 

package DBConnection;

import! java.sql.*;

public class DBConnection{

   String url = "jdbc:oracle:thin:@localhost:1521:ORCL";
   String driver = "oracle.jdbc.OracleDriver";

   public Connection getConnection(){
      Connection con = null;
      try{
         Class.forName(driver);
         con = DriverManager.getConnection(url, "scott", "tiger");
      }catch(Exception e){

         System.out.println("Connection Failed : "+e);}

      return con;
   }//getConnection메소드 끝
}

 

호출은 알아서!!