<%@ page contentType="text/html;charset=euc-kr" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.PreparedStatement" %>
<%
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@111.111.222.111:1521:tydev64";
String id = "adss";
String pass = "dsdsd";
Connection conn = DriverManager.getConnection(url, id, pass);
Statement stmt=conn.createStatement();
StringBuffer sql = new StringBuffer();
sql.append("SELECT COMMENTS FROM USER_COL_COMMENTS \n");
sql.append("WHERE TABLE_NAME LIKE 'GVE%' \n");
sql.append("AND COLUMN_NAME = 'ADD_USER_ID' \n");
sql.append("AND COMMENTS IS NOT NULL \n");
sql.append("AND ROWNUM = 1 \n");
ResultSet rs=stmt.executeQuery(sql.toString());
String comments = "";
while(rs.next()){
comments = rs.getString("COMMENTS");
}
out.print("데이터베이스연결성공" + comments);
conn.close();
} catch(SQLException e) {
out.println("데이버베이스연결실패");
}
%>
[출처] [본문스크랩] 오라클 db 접속 테스트(jsp)|작성자 개장수
댓글을 달아 주세요