• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

SQLException:Parameter Index out of Range

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I'm getting a SQLException with description "Parameter Index out of range(1) number of parameters, which is (0).

Here's the code:


And the stack trace:


Why do I get this exception and where is the error in my code? Any help would be much appreciated...
 
Rancher
Posts: 1946
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few mistakes in the code, those I could trace, as per your sql query there is no unknown parameters,
so I did not understand the use of pstmt.setString methods(so one cause of indexoutofbounds is happening here)
Secondly as per your query you are selecting only qtyoforder, but in the rs.next loop,
you are calling getString("customername")(one more cause of error)
 
Swapna Gouri Kalanidhi
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Swastik, it's working after modification... !
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!