<%@ page contentType = "text/html; charset=euc-kr" %>
<%@ page import="java.sql.*, java.util.*" %>
<%
String db_url="jdbc:mysql://localhost:3306/itppbx7"; <<== 서버 정보
String db_user = "itppbx7"; <<== 아이디
String db_pass="itppb7xrw"; <<== 비밀번호
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("org.gjt.mm.mysql.Driver"); <<== odbc 접속 환경에 맞게 설정해야함
conn = DriverManager.getConnection(db_url,db_user,db_pass);
stmt = conn.createStatement();
} catch (SQLException e) {
out.println(e);
}
try {
StringBuffer sql_str = new StringBuffer();
sql_str.append(" select * from ippbx_member "); <<== mysql select
rs = stmt.executeQuery(sql_str.toString()); <<== mysql result
while(rs.next()) {
out.println(rs.getString("id")+"|");
out.println(rs.getString("id_type")+"|");
out.println(rs.getString("phone_type")+"|");
out.println(rs.getString("passwd")+"|");
out.println(rs.getString("phone_passwd")+"|");
out.println(rs.getString("id_name")+"||");
out.println(rs.getString("extension")+"|");
out.println(rs.getString("voip_tel")+"|");
out.println(rs.getString("forward_when")+"|");
out.println(rs.getString("forwarding")+"||");
out.println(rs.getString("groupcode")+"|");
out.println(rs.getString("prevent")+"|");
out.println(rs.getString("call_waiting")+"|");
out.println(rs.getString("force_cidnum")+"<BR>");
}
} catch (SQLException e) {
out.println(e);
} catch (Exception e) {
out.println(e);
} finally {
if (rs != null) try { rs.close(); } catch(Exception e) {}
if (stmt != null) try { stmt.close(); } catch(Exception e) {}
if (conn != null) try { conn.close(); } catch(Exception e) {}
}
%>
mysql 을 사용해 보셨으면 충분히 소스 분석이 가능하리라 생각됩니다~.