• 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Explanation needed for this phrase by Oracle  RSS feed

 
Ranch Hand
Posts: 484
  • 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: 21649
101
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.
 
Marshal
Posts: 24195
54
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.
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!