$ cat MysqlTest.jsp
<%@ page import="java.sql.*" contentType="text/html;charset=euckr"%> <html> <head> <title>mysql Á¢¼Ó Å×½ºÆ®</title> <meta http-equiv="Content-Type" content="text/html; charset=euc-kr"> <body> <% String DB_URL = "jdbc:mysql://localhost:3306/db_name"; String DB_ID = "db_id"; String DB_PW = "db_password";
Connection conn = null;
try { Class.forName("org.gjt.mm.mysql.Driver"); out.println("1 ´Ü°è. JDBC Driver ·Îµå : success<br>"); } catch(Exception ex) { out.println("1 ´Ü°è. JDBC Driver ·Îµå : failure<br>"); }
try { conn = DriverManager.getConnection(DB_URL, DB_ID, DB_PW); if(conn != null) out.println("2 ´Ü°è. MYSQL Á¢¼Ó : success"); } catch(Exception ex) { out.println("2 ´Ü°è. MYSQL Á¢¼Ó : failure"); } finally { if(conn != null) try { conn.close(); } catch(Exception ex) {} } %> </body> </html>
À§ °æ¿ì ¸ðµÎ finally ºÎºÐÀ» º¸½Ã¸é ¾î¶°ÇÑ °æ¿ì¶óµµ conn °´Ã¼´Â ´Ý¾Æ¾ß ÇÑ´Ù´Â Á¡¿¡ ÁÖÀÇÇϽñ⠹ٶø´Ï´Ù.
ÀÚ¼¼ÇÑ ¹®ÀǴ¡º 02-3429-1917~9 ¡»À¸·Î
Àüȸ¦ Áֽðųª,
¡º
server@blueweb.co.kr¡»·Î ¸ÞÀÏÀ» ÁֽʽÿÀ.
Ä£ÀýÇÏ°Ô ´äº¯ÇØ µå¸®°Ú½À´Ï´Ù.
|