| Author |
Who implements Connection Interface & PreparedStatement Vs connection.executeQuery.
|
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
1) Which class implements Connection interface ? 2) When to use PreparedStatement and when to use connection.executeQuery(....); ??? Thanks.
|
Jigar Naik
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
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?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Jigar Naik
Ranch Hand
Joined: Dec 12, 2006
Posts: 744
|
|
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
Joined: Apr 14, 2004
Posts: 10336
|
|
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.
|
 |
 |
|
|
subject: Who implements Connection Interface & PreparedStatement Vs connection.executeQuery.
|
|
|