• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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: 2369
25
  • 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: 3610
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
 
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!