aspose file tools*
The moose likes JDBC and the fly likes error in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "error in servlet" Watch "error in servlet" New topic
Author

error in servlet

Namrata Kakkar
Greenhorn

Joined: Aug 24, 2009
Posts: 6
I have made one html page using javascript.Whenever the control goes to the servlet page it shows database error.

the exception isjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
I am using MS-Access for database



Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Namrata Kakkar wrote:


if you output the SQL created by above line, you should see the problem. If you don't, try pasting this query into Access and see what happens. That is what I do when I can't make a query work.

Also, you should be using parametrized queries.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

I assume account and password are text/character type fields



and the field names used are correct as defined in the table.
However using PreparedStatement is always a better approach.


Swastik
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Moved to the JDBC forum


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error in servlet