Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tomcat :: Access 2000 :: Java Servlet :: ODBC Error

Status
Not open for further replies.

delereum

Programmer
Jan 2, 2004
5
US
i am trying to design a servlet which will access user comments from a table in an access database. i was using oracle and cannot resolve a problem with it so i switched to the access file i used prior. i have a statement that says:

String query = "SELECT Comment, Username, ISBN FROM Reviews WHERE ISBN LIKE '" + isbn + "'";

this compiles normally and then when opened gives a message "Microsoft ODBC Driver. Too few parameters. Expected 1." and then quits the apache tomcat server completely. there is another servlet i am using to access the same database in the previous page which has a similar statement:

String query = "SELECT Title, Author, ISBN, Cost, QuantityOnHand FROM Products ";
if ( title != null & ! title.equals ("") )
query = query + "WHERE Title LIKE '" + title + "' ";

if (author != null & ! author.equals ("") )
if (query.indexOf ("WHERE") == -1 )
query = query + "WHERE Author LIKE '" + author + "' ";
else
query = query + "OR Author LIKE '" + author + "' ";

if (isbn != null & ! isbn.equals ("") )
if (query.indexOf ("WHERE") == -1 )
query = query + "WHERE ISBN LIKE '" + isbn + "' ";
else
query = query + "OR ISBN LIKE '" + isbn + "' ";


I am a bit stumpped and i did not know if this should be posted on java, access or tomcat. so i will try here first. any suggestions for me?
 
The first error message you gave basically means that there is a fieldname missing or wrong. Access then interprets your "new fieldname" as a parameter, and as such expects a parameter input before the query is opened. No parameter is supplied, so it throws this very cryptic error.


So check your table structure, starting with "Comment, Username, ISBN".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top