• 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

Set string parameter to Prepared Statement

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic