Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

simple error

 
Gopi Krrishna
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Roy Simon
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First question: why are you using the JDBC:ODBC bridge? Does your database not provide a better driver?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!