• 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

Who implements Connection Interface & PreparedStatement Vs connection.executeQuery.

 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Which class implements Connection interface ?

2) When to use PreparedStatement and when to use connection.executeQuery(....); ???

Thanks.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this homework? Generally we don't like to simply answer questions. What do you think the answers are? Have you read the JavaDocs on PreparedStatement and Connection?
 
Jigar Naik
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i dont have any idea which class implements Connection,

and about prepared statement when we want to execute a query more frequently we should use prepared statement am i right ?

ok i'm going through JDBC Basic Tutorials.
[ June 19, 2007: Message edited by: Jigar Naik ]
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.sql.Connection (along with all the other JDBC interfaces) are implemented by the driver you choose.

PreparedStatements have a number of advantages over Statements. They represent precompiled, cached statements so should perform better than ad-hoc statements. They also use parameter binding which hides the logic required to escape database specific formatting issues: i.e. need to escape quotes, or ensure date strings are formatted a particular way.
reply
    Bookmark Topic Watch Topic
  • New Topic