wood burning stoves 2.0*
The moose likes JDBC and the fly likes Retreiving data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retreiving data " Watch "Retreiving data " New topic
Author

Retreiving data

Beena Thomas
Greenhorn

Joined: Sep 26, 2001
Posts: 5
I am trying to retrieve records from a table "Retrieval" using
SQL statement inside a JSP page
<%<br /> <br /> "SELECT * FROM Retrieval WHERE File_Date Between sDate And eDate"<br /> %>
inwhich sDate and eDate are obtained as values from html using httpRequest getParameter methods in the form of string
<%<br /> startMonth=request.getParameter("startMonth");<br /> startDate=request.getParameter("startDate");<br /> startYear=request.getParameter("startYear");<br /> endMonth=request.getParameter("startMonth");<br /> endDate=request.getParameter("startDate");<br /> endYear=request.getParameter("startYear");<br /> <br /> sDate=startMonth+"/"+startDate+"/"+startYear;<br /> eDate=endMonth+"/"+endDate+"/"+endYear;<br /> %>
My Acess Db is having field "File_Date" of type Date/Time where I formatted it as shortDate and input mask 00/00/00
It is Giving following errors
javax.servlet.ServletException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
at jsp.deedRetrieval_15._jspService(Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Compiled Code)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Compiled Code)
at org.apache.tomcat.core.ContextManager.service(Compiled Code)
atorg.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Compiled Code)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)
Root cause:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Compiled Code)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:4246)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:1172)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:206)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:131)
at jsp.deedRetrieval_15._jspService(Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Compiled Code)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
Could anyone please help me with this
Thanks
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

It would be nice if you could post the relevant code(no html or tags) that is throwing the SQLException. I have seen this error message when I have misspelled a column name. The error message is not what you'd expect but that is what happened. But without the code, it is hard to speculate!
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retreiving data