Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Explanation needed for this phrase by Oracle  RSS feed

 
Ranch Hand
Posts: 468
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read this

https://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#prepareStatement%28java.lang.String,%20int%29  


sql - an SQL statement that may contain one or more '?' IN parameter placeholders

I hope someone can tell me if this sql has to be an insert sql query with ? according to the number of parameters or it can be other sql query.

Tks.

 
Sheriff
Posts: 21558
100
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use any type of query with prepareStatement, not just INSERT.
 
Sheriff
Posts: 23970
50
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the documentation specifically says that the second parameter is ignored if the first parameter isn't an INSERT statement (or some other obscure things). So it would be pointless to use this method for statements other than INSERT, but not against the rules.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!