• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PreparedStatement and CallableStatement?

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys! Can anyone give the advantages/disadvantages of PreparedStatement/CallableStatement?Which one is better to use?
thanks!
raymond
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PreparedStatement is for regular SQL. CallableStatement is for prepared statements.
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prepared statements are compiled only once and rest of the time just datas are placed
It is just same as that of writting a query in the sql plus.
like
insert into emp (id,name) values (?,?)
evey time you will say &
this same as that of prepared statement.
if you have oracle then you can see.
Callable statements are used to execute stored procedured
 
raymond yadao
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've read some article on the internet that says callablestatement(stored proc) is much faster than the preparedstatement.the only problem is that using stored proc, you're tied up to a certain db.what if in the future you change db?
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because you know which JDBC driver you are using. According to your driver you will write sql statement in Statement, PrepareStatement & Call... etc. As of I know all database has some variation to sql & not all has store procedure like on in Oracle using PL/SQL...just a input...
 
reply
    Bookmark Topic Watch Topic
  • New Topic