Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Oracle/JAVA Connections

RE: Oracle/JAVA Connections

From: Justin Cave (DDBC) <jcave_at_ddbcinc.com>
Date: Wed, 1 Jun 2005 10:07:53 -0600
Message-ID: <87E9F113CEF1D211A4C3009027301874759A2D@ddbcinc.ddbc.local>


The normal pattern for Java server pages is to open a connection as the first action on the page and to close that connection as the last action on the page (taking care that the close happens whether the page generates an exception or not). The application will generally maintain a connection pool so you won't be opening physical connections every time, you are just pulling a connection from the pool and returning a connection to the pool.

My guess is that when you are doing the connection pooling you are holding on to the same Connection object after the login has failed. You would normally close that Connection and open a new one using the new credentials.

Justin Cave =20
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of LeRoy Kemnitz Sent: Wednesday, June 01, 2005 11:53 AM
To: oracle-l_at_freelists.org
Subject: Oracle/JAVA Connections

All -

I am having problems with our Java app and hope someone here can help. =20 We are using Oracle dedicated connections. We tried the Connection=20 pooling with Oracle Impl but had no luck. The problems we are having=20 are this -

  1. When we try the dedicated connections (no pooling), the app starts=20 up and the first user logs in fine. They retrieve and all is fine. The

same person logs in again in new and 2nd browser, the connection is made

just fine. But when we logout, just the last connection shows as being=20 disconnected fro Oracle. The other connection is left as orphan. The=20 orig browser can no longer function and needs to be closed. What are we

missing? Do we need to name each connection uniquely and call the close

for each one as they close? I thought Java would attach one connection=20 to each session and close it when requested.

2. When we use connection pooling, the pool is defined as Dynamic and=20 using the OracleImpl. We connect outside the pool first to be sure of=20 good login. Once we have good login we move the connection to the pool=20 and getConnection. This disconnects the orig connection and is added to

the pool. This works great. Now we try to login incorrectly the first=20 time. This works and prompts you telling us to 'Login with Correct=20 Username/password'. But if we give it a correct set of=20 username/password then it returns database error. It seems as though it

keeps the error in memory for that userid. We can go out and whack the=20 Work files for Tomcat and force it to re-compile and then it works great

the first time. We change the struts-config to not cache but it still=20 did it. We then tried to check with the Tomcat Admin to see if he knew=20 of a caching parm for Tomcat. He said 'Not that he knew of.' Is there=20 a parm for Tomcat to force re-compile each time? Are we missing=20 something else? Any help would be appreciated.

By the way, our platform is WebSphere 5.1.2 on Windows pc with Tomcat=20 locally. We also have a web server on AIX/Unix running Tomcat. We=20 develop locally and deploy to the test server.

LeRoy

--

http://www.freelists.org/webpage/oracle-l
--

http://www.freelists.org/webpage/oracle-l Received on Wed Jun 01 2005 - 12:07:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US