Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 18th, 2002, 10:05 AM
sgaucho sgaucho is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 26 sgaucho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 28 sec
Reputation Power: 0
jdbc connection..

Hi,

a simple question..

I open a connection to a oracle/mysql db.
Create a statement
Create a ResultSet

Execute statement..
execute the Resultset..

DONT close the statement..
DONT close the ResutlSet

CLOSE the connection..

Would this automatically close the statement and resultset??

any explanations??
thnx,
sgaucho

Reply With Quote
  #2  
Old September 18th, 2002, 08:23 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
From the javadoc:
Quote:
public void close()
throws SQLException

Releases a Connection's database and JDBC resources immediately instead of waiting for them to be automatically released.


That sounds to me like everything gets closed. And I know for a fact that you can't use a ResultSet after the connection has been closed.

Reply With Quote
  #3  
Old September 19th, 2002, 03:11 AM
sgaucho sgaucho is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 26 sgaucho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 28 sec
Reputation Power: 0
Thnx...

but i had read somewhere that not closing the statements would leave open cursors in the database.. isnt it so?

My problem is I am opening connections to both Oracle and Mysql Databases and at the end of the script closing the connections to both..

But no matter what I do, I c that the connections are not freed at all.. In one case I open two connections to 2 diff databases in MySQL and in the Mysqlfront I see that about 40 connections are spawned/created and hardly 50 % are closed/freed at the end!!!!!

Why does this happen and how do I remedy this??

thnx again,
sands

Reply With Quote
  #4  
Old September 19th, 2002, 10:33 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Well, it's possible that java hasn't gotten around to garbage collecting the connections, yet. That seems like it would be horribly innefficient to me, though.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > jdbc connection..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway