Win a copy of Java 9 Revealed this week in the Features new in 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
IntelliJ IDE Java Windows
  • 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: 42970
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 Hand
Posts: 2554
27
  • 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
IntelliJ IDE Java Windows
  • 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: 3639
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!