자주묻는질문(FAQ)
JNDI 없는 MySQL 연결 예제
- 관리자
- 2016.12.05 09:49:26
- 1,499
<%@ page import="java.sql.*, javax.sql.*, java.io.*" %>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/DB명", "DB아이디" , "DB비밀번호");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("query");
while (rs.next()) {
처리문
}
rs.close();
stmt.close();
conn.close();
%>