wood burning stoves 2.0*
The moose likes JDBC and the fly likes Preparestatement Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Preparestatement Class" Watch "Preparestatement Class" New topic
Author

Preparestatement Class

laila NiHai
Ranch Hand

Joined: Oct 18, 2010
Posts: 35
Hello,

I have many repreated queries and would like to set up PreparedStatements and use a class for each query that returns the ResultSet. Do you know of any examples to do so? I am fuzzy on how to handle setting the parameters for the preparedstatement that has different data types. I would appreciate any pointers you may have....
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18712
    
    8

I didn't know of any specific examples, but when I put "preparedstatement tutorial" into Google, the first link that came back was the Oracle tutorial: Using Prepared Statements. When your web search produces a list of tutorials, usually the best choice is the Oracle tutorial if there is one.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

laila NiHai wrote:Hello,

I have many repreated queries and would like to set up PreparedStatements and use a class for each query that returns the ResultSet. Do you know of any examples to do so? I am fuzzy on how to handle setting the parameters for the preparedstatement that has different data types. I would appreciate any pointers you may have....


Just like Paul says, you'll be best served to check the tutorial, then make an attempt to code a simple prepared statement. If you get stuck, post what code you have. You can also search in Google Code Search for preparedStatement:
http://www.google.com/codesearch?as_q=preparedStatement&btnG=Search+Code&hl=en&as_package=&as_lang=java&as_filename=&as_class=&as_function=&as_license=&as_case=yes
laila NiHai
Ranch Hand

Joined: Oct 18, 2010
Posts: 35
Thanks Paul and Tim for the pointers. I never knew Google Code Search existed. Learning something new everyday...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Preparestatement Class