jdbc¿Í ¿À¶óŬ7.3ÀÇ ¿¬°á


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :±è¿µ¼± 2000³â 6¿ù 18ÀÏ 14:08:58

In Reply to: JDBC°ü·Ã ¿À¶óŬ ¿¡·¯... posted by ±è¸Å°æ on 2000³â 6¿ù 08ÀÏ 09:58:52:

´ÙÀ½ ÄÚµå·Î Çѹø ÃʱâÈ­ ½ÃÄѺ¸¼¼¿ä..


----> new Database();
//¼Ò½º
import java.util.*;
import java.sql.*;


public class Database{
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;


public Database(String serverName){
//String serverName = "203.237.102.167";//¼­¹öÀÇ À̸§À» ÀÔ·Â ip or È£½ºÆ®À̸§
String DB_URL = ("jdbc:oracle:thin:@"+serverName+":1521:ORCL");//ÇÁ·ÎÅäÄÝÀ̸§
String ID = "scott";
String PASS = "tiger";

//driver loading
try{
Class.forName("oracle.jdbc.driver.OracleDriver");//µå¶óÀ̺êã±â
}catch(ClassNotFoundException e){
e.printStackTrace();
}

//db connect
try{
conn = DriverManager.getConnection(DB_URL,ID,PASS);//Ä¿³Ø¼ÇÇϴºκÐ
stmt = conn.createStatement();//°´Ã¼¸¦ »ý¼ºÇÏ´Â ºÎºÐ
//session connect //¼¼¼ÇÀ» ¿¬°áÇÏ´Â ºÎºÐ
}catch(SQLException e){
e.printStackTrace();
}
}


//Close the connection with the database server
//µ¥ÀÌŸº£À̽º¿ÍÀÇ ¿¬°áÀ» ÇØÁ¦throws SQLException
public void close() {
try {
conn.close();
}catch(SQLException e){
System.out.println("Disconnection error");
}
}
}


´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]