Lock on GetConnection

Hi all,

i've a thread that open a jdbc thin connection on oracle db in every instance of it.

for explain something like this:

public void run()

{

........

Connection conn=null;

try{ ....

................< log lines 1>

conn=DriverManager .getConnection();

conn.setAutocommit(false);

................< log lines 2>

.................................

......< insert statement > .......

.................................

} catch (Exception e)

{

}

finally{

.......

if (conn!=null)

conn.close();

......

}

}

)

A new instance of thread starts every 2 minutes.

After some hours, all thread seems to be locking on DriverManager.getConnection() and i don't know why.

I think that there is a lock because no exception is throws and i can see the <log line 1> but not the <log line 2>.

Have you some idea about this problem?

My Database is Oracle 7.3

The Jdbc library is classes111.jar

JVM is 1.4.1_07

Thanks alot

[1127 byte] By [SmartBart1701ea] at [2007-11-27 11:52:19]
# 1

i think there could be an exception thrown while u're trying to get a connection at the first time. try to print out the exception inside the catch block and see what it comes out.. if exception thrown, the finally block may not be able to close the connection...

hope this help..

JWKC-5ivea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

in the catch block there is a log that is not logget.

I don't think that an exception occurs.

SmartBart1701ea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

There is a lock because the the thread remains in wait, and after some time an OutOfMemoryError Occurs.

SmartBart1701ea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

So essentially you are starting these threads but they are never exiting.

And running out of connections. And memory. And probably other resources.

Well I suggest you fix that.

cotton.ma at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

> So essentially you are starting these threads but

> they are never exiting.

>

> And running out of connections. And memory. And

> probably other resources.

>

> Well I suggest you fix that.

How?

SmartBart1701ea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6

By reading the code.

BalusCa at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 7

> By reading the code.

Pheraps i'm not explains well.

I think that the problem is in the code but i don't know how is possible a Lock on DriverManager.getConnection(cooString, user, pass) statement.

If some one can say my this i'll know how search in source code.

SmartBart1701ea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 8

can u attach the whole method here so that we can discuss further?

JWKC-5ivea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 9

where is the difference between oracle.jdbc.OracleDriver class and oracle.jdbc.driver.OracleDriver class?

I use the last.

Can be it the cause of my problem?

SmartBart1701ea at 2007-7-29 18:43:41 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...