티스토리 뷰

반응형

12년 1월 기준.

 

<%

String DB_URL = "localhost";

String DB_USER = "user";

String DB_PWD = "pwd";

String url="jdbc:mysql://"+DB_URL;

//String url="jdbc:mysql://"+DB_URL+"/mysql?useUnicode=true&characterEncoding=utf-8";

Connection conn = null;

Statement stmt = null;

ResultSet rs = null;

try

{

Class.forName("com.mysql.jdbc.Driver");

conn = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD);

stmt = conn.createStatement();

String query = "select * from db";

rs = stmt.executeQuery(SQL);

while (rs.next()) {

out.println(rs.getString(1));

}

rs.close();

conn.close();

stmt.close();

} catch(Exception e)

{

out.println(e.getMessage());

}

%>

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함