i want to create a simple form which stores date in to a ms access db
so i created a form register.html and action user_register.jsp
i also created a ms aceess db
when i fill the form the data is passed to the Auction.mdb but the server shows error
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /user_register.jsp:11
8: <% Statement myStatement = myConn.createStatement (); %>
9: <% String StrUser = request.getParameter("username"); %>
10: <% String StrPass = request.getParameter("password"); %>
11: <% ResultSet myResult = myStatement.executeQuery("INSERT INTO Auction([UserName], [Password]) VALUES ('"+StrUser+"', '"+StrPass+"')"); %>
12: <% myConn.close(); %>
13: </BODY>
14: </HTML>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
javax.servlet.ServletException: No ResultSet was produced
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.user_005fregister_jsp._jspService(user_005fregister_jsp.java:77)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.sql.SQLException: No ResultSet was produced
sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:259)
org.apache.jsp.user_005fregister_jsp._jspService(user_005fregister_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.
the regiser.html is
<html>
<head>
<title>Welcome to the Action...</title></head>
<body>
<form action="user_register.jsp" method="post">
Username:<input type="text" name="username">
Password:<input type="password" name="password">
<input type="submit" name="okfunc" value="OK">
</form></body></html>
user_register.jsp is
<HTML>
<BODY>
<%@ page language="java" import="java.sql.*" %>
<% String url = "jdbc:odbc:Auction", user="", passwd=""; %>
<% Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); %>
<%--<% Connection myConn = DriverManager.getConnection (url, user, passwd); %> --%>
<% Connection myConn = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/Auction/Auction.mdb"); %>
<% Statement myStatement = myConn.createStatement (); %>
<% String StrUser = request.getParameter("username"); %>
<% String StrPass = request.getParameter("password"); %>
<% ResultSet myResult = myStatement.executeQuery("INSERT INTO Auction([UserName], [Password]) VALUES ('"+StrUser+"', '"+StrPass+"')"); %>
<% myConn.close(); %>
</BODY>
</HTML>
i m very new to jsp so any help wud be gr8
thanx in advance