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 simple error 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 "simple error" Watch "simple error" New topic
Author

simple error

Gopi Krrishna
Greenhorn

Joined: Feb 15, 2006
Posts: 12
Given is the simple code to add ip address in the table named ip_table
which it creates..
but i am unable to successfully add the data into the table..
i am getting the error as
"too few parameters. expected 1"

please help



SCJP 1.4
Roy Simon
Ranch Hand

Joined: Aug 26, 2005
Posts: 62
There is a syntax error in your query
//statement.execute("insert into ip_table values(address)")

this should be
string query = "insert into ip_table values('" + address + "')";
statement.execute(query);

Regards
Roy
[ March 08, 2007: Message edited by: Roy Simon ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

First question: why are you using the JDBC:ODBC bridge? Does your database not provide a better driver?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: simple error
 
Similar Threads
Servlet becomming slow
using data base Access
ERROR: java.sql.SQLException: No data found
How to separate Business Logic from the servlet
from servlet i want to use Ms Access