File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Too few parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Too few parameters" Watch "Too few parameters" New topic
Author

Too few parameters

Hilton Meyer
Greenhorn

Joined: Nov 13, 2003
Posts: 17
hi there,
the problem I'm having seems to be a common one amoung newbies to the java JDBC world but here it goes again. I'm getting the error that I have to few parameters and I'm aware that it means there's something wrong with my code. I have checked the SQL in Access and it world perfectly. I don't know if I'm doing something worng in the implementation of the database. Please could someone take a look and point me in the right direction. Thanks


Keep it Tidy
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

Post the error, please?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Hilton Meyer
Greenhorn

Joined: Nov 13, 2003
Posts: 17

The error it kicks out is :
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
I've taken the SQL into Microsoft and it workd there so I'm not sure if there is something that I'm missing in terms of java code. I'm pretty new to this stuff so I really am not sure if I've left something out. The initial connection works when the class is initialized but once I press the command button to generate the result it bombs out.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

Try using single quotes rather than double-quotes in the query
Hilton Meyer
Greenhorn

Joined: Nov 13, 2003
Posts: 17
I figured out the problem. I was trying to use double quotes instead of simply single quotes. I come from a VB background so just got the syntax a bit wrong
 
jQuery in Action, 2nd edition
 
subject: Too few parameters
 
Similar Threads
Error messages using ODBC
Need help with insert values into access
JDBC applets
SecurityException when running applet in IE5
new to JDBC - please help!