<%@ page language="java" contentType="text/html; charset=euc-kr"
pageEncoding="euc-kr"%>
<%@ page import="java.sql.*,javax.sql.*,javax.naming.*" %>
<
html
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=euc-kr"
>
<
title
>Insert title here</
title
>
</
head
>
<
body
>
<%
request.setCharacterEncoding("euc-kr");
String text = request.getParameter("text");
String uuid = request.getParameter("uuid");
String nick = request.getParameter("nick");
String lat = request.getParameter("lat");
String lon = request.getParameter("lon");
String clock = request.getParameter("clock");
Connection conn = null;
Statement stmt = null;
try{
Class.forName("com.mysql.jdbc.Driver");
stmt = conn.createStatement();
String command = String.format("insert into board" + "(uuid, nick, text, lat, lon, clock) values ('%s','%s','%s','%s','%s','%s');",uuid, nick, text, lat, lon, clock);
int rowNum = stmt.executeUpdate(command);
if(rowNum<
1
)
throw new Exception("데이터를 DB에 입력할 수 없습니다.");
}finally{
try{
stmt.close();
}catch(Exception ignored){
}try{
conn.close();
}catch(Exception ignored){
}
}
%>
</
body
>
</
html
>