23DAY /
DriverDB.java
package kr.or.ksmart.driverdb;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DriverDB {
public Connection driverDbcon() throws ClassNotFoundException, SQLException{
System.out.println("driverDbcon DriverDB.java");
Connection reconn = null;
Class.forName("com.mysql.jdbc.Driver");
String jdbcDriver = "포트번호";
String dbUser = "dbid";
String dbPass = "dbpwi";
reconn = DriverManager.getConnection(jdbcDriver, dbUser, dbPass);
return reconn;
}
}
1) 기존파일 (ex - user_list) 에 import
<%@ page import ="kr.or.ksmart.driverdb.DriverDB" %>
2)드라이버 로딩 부분 삭제 후 입력
DriverDB db = new DriverDB();
conn = db.driverDbcon();