Thursday, July 02, 2009

DB2 / Oracle JDBC연결법

오라클 JDBC연결

 

☞ thin 방식


Class.forName("oracle.jdbc.driver.OracleDriver");


Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:SID", "scott", "tiger");

 

☞ oci 방식


Class.forName("oracle.jdbc.driver.OracleDriver");


Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@ORA73", "scott", "tiger");

 

 

DB2 Jdbc 연결

 

☞ DB2 UDB APP Driver Test

 

Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();


Connection conn = DriverManager.getConnection("jdbc:db2:dbname", "user", "password");


☞ DB2 UDB Net Driver Test

Class.forName("COM.ibm.db2.jdbc.net.DB2Driver").newInstance();


Connection conn = DriverManager.getConnection("jdbc:db2://localhost:6789/dbname", "user", "password");

 

 

DB2를 안써봐서 연계땜시 찾은것...

 

첨부는 DB2 8.1.x버전에서 제공하는  JDBC 드라이버;; type 3 

No comments: