|
import java.sql.*;
public class DbConnectionTest
{
public static void main(String [] args){
String db_driver="oracle.jdbc.driver.OracleDriver";
String db_url="jdbc:oracle:thin:@127.0.0.1:1521:ioio";
String db_user="username";
String db_password="1111";
Connection dbcon = null;
try{
Class.forName(db_driver);
}catch(ClassNotFoundException e){
System.out.println("JDBC µå¶óÀ̹ö¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù." + e);
}
try{
dbcon = DriverManager.getConnection(db_url,db_user,db_password);
System.out.println("¿¬°á¼º°ø");
}catch(Exception e){
System.out.println("DB¿¡ ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù.");
}finally{
try{
if(dbcon != null) dbcon.close();
}catch(Exception e){}
}
}
}
|