This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error mysql database : java.sql.SQLException: No value specified for parameter 32  RSS feed

 
Tom Storm
Ranch Hand
Posts: 31
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to add the following data to a localhost mysql database. I extract information from files and then I try to add it to the database with the following code. If I remove one of the parameters the problem continues to persist on the last parameter. Am I doing something incorrectly or is the code correct?


Thanks to all who reply.
TS
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to use "++col" wherever you have "col++" now. As it is, parameter 1 is set twice.
 
Dave Tolls
Ranch Foreman
Posts: 2996
37
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I think you need to use "++col" wherever you have "col++" now. As it is, parameter 1 is set twice.


Either that or do col++ for the first assignment, rather than just col.

(Always looking for the least typing...)
 
Tom Storm
Ranch Hand
Posts: 31
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to both of you. I can't believe I spent so long trying to fix it!
TS
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The parameter count can be an issue using such an approach. The other issue is that the sql statement (line with ?) does not have the correct number of ?!!

Either one happened to me in the past. lol
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!