odbc 연결 테스트~
import java.sql.*;
class JDBC_Connect{
public static void main(String[] args) {
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:orcl";
Connection con = null;
Statement stmt = null;
try{
Class.forName(driver);
con = DriverManager.getConnection(url, "scott", "tiger");
stmt = con.createStatement();
System.out.println("DB connect ok");
}
catch(Exception e){
System.out.println("DB connect fail");
}
finally{
try{
if(stmt != null) stmt.close();
if(con != null) con.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
}
}
C:\Program Files\Java\jdk1.6.0_18\jre\lib\ext 에 ojdbc14.jar 파일이 있어야지만 연결이 된다.