
|
[oracle-l]
||
[Date Prev]
[06-2005 Date Index]
[Date Next]
||
[Thread Prev]
[06-2005 Thread Index]
[Thread Next]
RE: Oracle/JAVA Connections
- From: ryan_gaffuri@xxxxxxxxxxx
- To: jcave@xxxxxxxxxxx, "LeRoy Kemnitz" <lkemnitz@xxxxxxxx>
- Date: Wed, 01 Jun 2005 17:23:34 +0000
connection pooling actually doesn't work that. you get a connection until you
commit or go out of scope, or for every time you 'close' a connection. its
entirely possible to use the same connection if there are users on for multiple
selects.
depends how you code your jdbc too. If you get get a connection in your jdbc
code and do 5 selects, then you will use the connect(unless you go out of
scope), if you close the connetion(remember with connection pooling you are not
closing the database connection), you may use a different connection. It's up
to the middle tier.
The jsp screen has nothing to do with it. It's at a seperate layer from the
database connection(unless you put your jdbc code in the jsp, but java guys are
correctly taught not to do that).
If you are using entity type EJBs, then you have NO control of how database
connections work. DML changes, are in memory changes at the middle tier and the
application server decides when to make the actually dml changes, plus on
selects you may just be getting a record that is already in memory(this is
where people have had problems with not seeing changed data, because the
application does not always requery... I have never seen it, but read about
it). Your SQL will go in the entity ejb, however, the user does not have access
to call it. The application server does a 'call back' to grab the correct sql
statement.
If you are using data access objects, then every call to it, is a call to the
database. However, remember you are going to the middle tier. Do a search for
the code that has data access for the keyword 'lookup', this is where you are
grabbing your jdbc connection from the application server.
-------------- Original message --------------
> You're putting the connection logic in a JavaBean, then, right? The
> same principle would apply-- you would probably open and close the
> connection in whatever method fetched data from the database. The
> general principle is that your middle tier only has the database
> connection open for an instant for any particular user interaction and
> the application server takes care of handing out connections from the
> connection pool to the particular EJB/ servlet/ JSP that needs it. It's
> normal and expected that every time a particular user goes to a
> different page they will (potentially) be using a different physical
> connection. Since HTTP is stateless, the application server has no idea
> how to associate a particular connection object with requests coming
> from a particular browser, which is what it sounds like you are
> expecting to happen.
--
http://www.freelists.org/webpage/oracle-l
|

|