File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes PreparedStatement related query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "PreparedStatement related query " Watch "PreparedStatement related query " New topic

PreparedStatement related query

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 346
Hi every body I have a query related to PreparedStatement.

Is it necessary to explicit cast to conn.prepareStatement(sqlQuery); ?

My code is like this :

Which one is better ?

Smitesh Shinde
Ranch Hand

Joined: Feb 16, 2008
Posts: 45

You do not need to explicitly cast it as conn.prepareStatement itself returns object of type PreparedStatement
I agree. Here's the link:
subject: PreparedStatement related query
It's not a secret anymore!