クライアントからフィードバックを受け取り、MYSQLデータベースに保存する必要があるプレーンなJSPWebページを開発しています。
ローカルホストで実行している間、Apacheサーバーのデータベース接続は正常に実行されますが、EATJ.comでページをホストした後、データベースが期待どおりに更新されないため、以下のコードについてサポートを受けられますか?
コード:
<body>
<%@page import="java.sql.*"%>
<%
String name=request.getParameter("name");
String email=request.getParameter("email");
String comment=request.getParameter("comment");
try{
String connectionURL = "jdbc:mysql://localhost:3306/pizza";
ResultSet rs=null;
Connection con= null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(connectionURL, "prakashd22", "*******");
Statement st = con.createStatement();
String sql = ("INSERT INTO feedback VALUES ('" + name + "','" + email + "','"+ comment +"') ");
st.executeUpdate(sql);
rs.close();
st.close();
con.close();
}
catch(Exception e){out.print(e);}
%>
<jsp:include page="feed.jsp" />
</body>
</html>