The Connection you get from a javax.sql.DataSource is actually a facade 
to a real DB Connection (what you're thinking about).  Calling close() 
on the facade you get doesn't actually close the DB Connection, it just 
returns it to the pool.  If you don't return it using close() in a 
finally block you will quickly run out of database resources.  This 
behavior is standard and expected.

David

--

[EMAIL PROTECTED] wrote:
> What I am doing is to lookup a datasource in my session bean via jndi.
> Because I do NOT create it and I don't know what should happen after me
> (for instance commit() should be done by the container) I can't close the
> connection.
> Of course I close my statements, resultsets, etc.
> 
> Again I thought the container creates, commits and closes connections. BTW
> I have done it on Websphere too and I have the impression it works there
> that way. Therefor I think I have configured something wrong.
> 
> Regards,
> Stephan
> 
> 
> 
> 
> "Sacha Labourey" <[EMAIL PROTECTED]> am 28.05.2002 16:08:47
> 
> Bitte antworten an [EMAIL PROTECTED]
>                                                             
>                                                             
>                                                             
>   An:        [EMAIL PROTECTED]               
>                                                             
>   Kopie      (Blindkopie: Stephan Frind/Duesseldorf/Gebit)  
>   :                                                         
>                                                             
>                                                             
>                                                             
>   Thema      RE: [JBoss-user] no reuse of pooled            
>   :          XAConnections                                  
>                                                             
> 
> 
> 
> 
> 
> 
> you need to close your connection (and any other resources such as
> preparedstatements, resultset, etc.) in the finally clause of your try:
> try
> {
>      con = ds.getConnection();
>      ps = con.create...
> }
> catch (WhateverException we)
> {
>      bla;
> }
> finally
> {
>      try { ps.close (); } catch (Exception ignored) {}
>      try { con.close (); } catch (Exception ignored) {}
>      ...
> }
> 
>>-----Message d'origine-----
>>De : [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED]]De la part de
>>[EMAIL PROTECTED]
>>Envoye : mardi, 28 mai 2002 16:03
>>A : [EMAIL PROTECTED]
>>Objet : [JBoss-user] no reuse of pooled XAConnections
>>
>>
>>Hello folks,
>>
>>I have a stateless session bean with transaction set to required. I am
>>using JBoss2.4.5.
>>I fetch a connection
>>tempDS = (DataSource)tempIC.lookup(tempLookup);
>>if (tempDS != null) {
>>     try {
>>          tempConnection = tempDS.getConnection();
>>     } catch (SQLException se) {
>>          ...
>>     }
>>}
>>and work on it. When the invocation on my session bean ends I expect that
>>my connection is released and can be reused. But instead after a
>>while I am
>>getting
>>java.sql.SQLException: ORA-00020: maximum number of processes (150)
>>exceeded
>>     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
>>     at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
>>     at oracle.jdbc.ttc7.O3log.receive1st(O3log.java:428)
>>     at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:248)
>>     at
>>oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
>>     at
>>oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver
>>.java:365
>>)
>>     at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
>>     at java.sql.DriverManager.getConnection(DriverManager.java:517)
>>     at java.sql.DriverManager.getConnection(DriverManager.java:177)
>>     at
>>org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl.getXAConnection(XA
>>DataSourc
>>eImpl.java:176)
>>     at
>>org.jboss.pool.jdbc.xa.XAConnectionFactory.createObject(XAConnecti
>>onFactory
>>.java:282)
>>     at org.jboss.pool.ObjectPool.createNewObject(ObjectPool.java:1004)
>>     at org.jboss.pool.ObjectPool.getObject(ObjectPool.java:663)
>>     at
>>org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSo
>>urce.java
>>:215)
>>
>>Could you point me into the right direction? Could you give me a hint
> 
> what
> 
>>I may have missconfigured or where in the code the connection is put back
>>to the pool?
>>
>>Thanks a lot in advance,
>>Stephan
>>
>>
>>
>>_______________________________________________________________
>>
>>Don't miss the 2002 Sprint PCS Application Developer's Conference
>>August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>>
>>_______________________________________________
>>JBoss-user mailing list
>>[EMAIL PROTECTED]
>>https://lists.sourceforge.net/lists/listinfo/jboss-user
>>
> 
> 
> _______________________________________________________________
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> 
> 
> _______________________________________________________________
> 
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user



-- 

---------------------
David Ward
[EMAIL PROTECTED]
http://www.dotech.com


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to