File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Who implements Connection Interface & PreparedStatement Vs connection.executeQuery.

 
Jigar Naik
Ranch Hand
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Which class implements Connection interface ?

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

Thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • 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: 761
  • 0
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic