This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Set string parameter to Prepared Statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Set string parameter to Prepared Statement" Watch "Set string parameter to Prepared Statement" New topic
Author

Set string parameter to Prepared Statement

Anirudha Joshi
Greenhorn

Joined: Apr 08, 2005
Posts: 22
Hello,

I am constructing a DAO which uses PreparedStatement to retrive data. DAO calls back different methods on the calling application to get SQL query, its parameters and other details (which are required to construct statement). Input parameter data types can be Int, Long or String.

As a common approach, can call call setString on all input parameters? Does it have any performance issue?

Anirudha
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Anirudha,
Yes, you can call setString() in all those cases. There might be a slight performance hit (if one at all), but not enough to worry about. Compared to the query and response time, it would be nothing.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set string parameter to Prepared Statement
 
Similar Threads
what is an another way of getting the form parametrs from jsps?
Getting HibernateException: Errors in named queries
Passing a string array as a parameter - urgent
Issue calling a stored procedure from Weblogic 8.1 workshop project
Transaction EJB session bean