Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Closing a callable statement and connection

 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Callable Statement:

I have overridden close() method and in that I am closing a statement object. Can I also use it for closing the CallableSatement Object?
or
Shall I have to write another close() [over ridden] metod to use the callable statement?

Connection:

I am passing the Connection object as an argument to a methd and after using connection object in that method is it required to close the connection object?

Thanks in advance
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Callable Statement:

I have overridden close() method and in that I am closing a statement object. Can I also use it for closing the CallableSatement Object?
or Shall I have to write another close() [over ridden] metod to use the callable statement?
If you are doing something special, then u should override the close() method else let it be executed with default implementation. As you know CallableStatement object is a subclass of Statement class, you can use the same close() method.

************************************
Connection:
I am passing the Connection object as an argument to a methd and after using connection object in that method is it required to close the connection object?
After you pass the connection object, to another method and after u have used it, i would prefer not to close the connection object in that called method.
If i don't need the connection method in the calling method after calling the another method, i would close the connection object in the calling method. This makes reading of code and debugging easy from my point of view.

Let me know if i am wrong.

Regards
Makarand Parab
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic