Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method with SQL parameter

 
Dan Parsons
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a method with parameters where one parameter has a prepared statement. Is the below the right direction?

[ October 08, 2007: Message edited by: Dan Parsons ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the prepareStatement object? Are you holding open a connection for some length of time? How do the prepared statement and connection JDBC objects get close?
 
Dan Parsons
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the prepareStatement object? Are you holding open a connection for some length of time? How do the prepared statement and connection JDBC objects get close?


Sorry didnt show the connection part and it is in my class file where I am opening in the method with the closing parts in a finally block.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get in now. You are trying to wrap the JDBC APIs in your own object. That's fine.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Dan,

2 questions for you:

-does 'prepstat' have to be a public property?

-the class that you posted, do you want to use it as a singleton?
(because it does not look very thread-safe if all requests use the same 'prepstat'


Herman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic