• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Closing DB issue in new method

 
Ed Carrington
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a method that inserts data into my Oracle 9i database with no problems and no Database closing issues:


Now when I put the method (inserter) in another class called OtherClass, it does insert the data but now I have database closing issues:



In my SQL Plus database resource check I see JDBC Thin Client is opened and not closed after each insert with the above attempt.
This didnt happen when I had the method in the same class.

Please advise.
[ October 15, 2007: Message edited by: Ed Carrington ]
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though this probably sounds excessive, your finally code should be protected line by line as such:


I've seen people not do this in the past and keep in mind, if an rs.close() or stmt.close() fails then without this type of structure the conn.close() might not be executed.

If it helps I usually add these add as static utility functions so I don't have to write this over and over again.
 
Ed Carrington
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Scott Selikoff:
Even though this probably sounds excessive, your finally code should be protected line by line as such:


I've seen people not do this in the past and keep in mind, if an rs.close() or stmt.close() fails then without this type of structure the conn.close() might not be executed.

If it helps I usually add these add as static utility functions so I don't have to write this over and over again.



Thanks I added as you suggested and still have the database closing issue.
Please advise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic