May be unrelated but make sure you closing the statement and result set.
John, you are right but closing the connection should close also resultset.
But this is not the problem because if I don't replace **B** with the second getConnection everything works fine.
PS: just tried jboss 2.4.4b but it did't help
I think the docs are wrong, although I am mostly familiar with how it works in 3.0 or 2.4 using ConnectionFactoryLoaders. All the connections you get will be enrolled in the same transaction. If you are using LocalTransaction (i.e. a non xa jdbc driver) you will get different handles to the same underlying physical connection. If you are using an xa driver you will actually be using different underlying connections. In either case, it wouldn't make much sense to return the same Connection handle: you wouldn't want closing one to affect another.
So... be sure to close every Connection you get. Depending on how bad the jdbc implementation is, you may need to also close every resultset and statement.
After doing some research I found out that my interpretation of the docs were wrong.
My understanding was that if I get a second connection from jboss it is the same object and calling close() on the second connection would also close/invalidate my first connection.
So the docs are right but misleading.
Well, I have a doubt in this regard - is there any means of finding in the jboss 3.0.7 server side and not in the Oracle 8 database server side,
how many connections are there in the pool,
how many connections are in use and
how many connections are being returned at a given point of time?