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: LeRoy Kemnitz <lkemnitz_at_uwsa.edu>
Date: Wed, 01 Jun 2005 11:40:28 -0500
Message-ID: <429DE4FC.8050705@uwsa.edu>


We tried to implement the MVC Architecture. We tried to keep the actions and JSPs dumb. We try to do the database connections in the business objects layer below the JSPs. So the action just calls the method in the Business Objects to retrieve the rows and all the JSP knows is that it gets rows.

Justin Cave (DDBC) wrote:

>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
>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.
>We are using Oracle dedicated connections. We tried the Connection
>pooling with Oracle Impl but had no luck. The problems we are having
>are this -
>
>1. When we try the dedicated connections (no pooling), the app starts
>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
>disconnected fro Oracle. The other connection is left as orphan. The
>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
>to each session and close it when requested.
>
>2. When we use connection pooling, the pool is defined as Dynamic and
>using the OracleImpl. We connect outside the pool first to be sure of
>good login. Once we have good login we move the connection to the pool
>and getConnection. This disconnects the orig connection and is added to
>
>the pool. This works great. Now we try to login incorrectly the first
>time. This works and prompts you telling us to 'Login with Correct
>Username/password'. But if we give it a correct set of
>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
>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
>did it. We then tried to check with the Tomcat Admin to see if he knew
>of a caching parm for Tomcat. He said 'Not that he knew of.' Is there
>a parm for Tomcat to force re-compile each time? Are we missing
>something else? Any help would be appreciated.
>
>By the way, our platform is WebSphere 5.1.2 on Windows pc with Tomcat
>locally. We also have a web server on AIX/Unix running Tomcat. We
>develop locally and deploy to the test server.
>
>LeRoy
>
>--
>http://www.freelists.org/webpage/oracle-l
>
>
>
>

-- 
LeRoy Kemnitz
UW System Administration
Database Administrator
780 Regent Street, #246
Madison, WI 53714
Phone: (608) 265 -5775
Fax: (608) 265 - 2090

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

Original text of this message

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