IMHO close and assigning conn=null are  not meant for same thing. close() is for releasing connection into pool(not to be garbage collected) so that it can be allocated to another TX. While later makes it eligible for garbage collection which any how will happen if you dont close the connection when returning from the fn.
But I dont know why you have to assign it to null after closing. At least I never do it. And not faced any problem on Weblogic
 
-Ashwani
 
----- Original Message -----
Sent: Wednesday, August 21, 2002 3:54 PM
Subject: Re: No resources available

hey thanks ashu,
 
it worked. but strange.
in my finally block i was writing like this
 
finally{
   try{
    if (con != null)
     con.close();
   }
   catch(SQLException sqle){
    throw new EJBException(sqle);
   }
  }
 
it should close the open connections in the finally block. Just i was not assigning it to null.
So it might not be getting garbage collected. That is why giving no resources available. Thanks for the input from all of you.

Vikram.
 -----Original Message-----
From: Ashutosh [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 3:23 AM
To: [EMAIL PROTECTED]
Subject: Re: No resources available

Hi,
    We faced a similar problem a few days back. The problem was that we were closing the connections explicitly after using it, but, still the problem persisted.         Following is the snippet of code that we used to release the connection-
try{
    if (aoConnection != null)
     aoConnection.close();
   }
   catch (Exception e){
        e.printStackTrace();
    }
The above code did not close and put the connections back into the pool.
The java documentation mentioned that - "In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release. "
 
However, surprisingly, when we equated the connection object to null, after calling close() ,we got the desired effect.
If close() is supposed to provide the same effect, why was it that we had to explicitly equate the connection reference to null ?
 
Any pointers ?
 
Thanks in advance,
Ashutosh
 
 
 
----- Original Message -----
From: "Milind Kulkarni" <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 3:22 PM
Subject: Re: No resources available

> Seems that you are exhausting the connection pool in WebLogic server. You
> have 2  options - increase the size of the Connection pool. Secondly check
> your code and ensure that you close all the Connections and Resultset after
> the procesing is over.
> Regards,
> Milind
>
>
>
>
>                     Vikramjit Singh
>                     <vikramjits@GTLLI        To:    
[EMAIL PROTECTED]
>                     MITED.COM>               cc:
>                     Sent by: A               Subject:     No resources available
>                     mailing list for
>                     Enterprise
>                     JavaBeans
>                     development
>                     <EJB-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     08/21/2002 02:40
>                     PM
>                     Please respond to
>                     Vikramjit Singh
>
>
>
>
>
>
> Hi everybody,
>
> I am working on weblogic 6.1 and have succesfully deployed a BMP.
> When i am running my client class, in which i am inserting 4 records into
> the database only the first 3 records get inserted then i get the following
> error
>
> weblogic.common.ResourceException: No resources available
>         at
> weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
> java:533)
>         at
> weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.
> java:379)
>         at
> weblogic.common.internal.ResourceAllocator.reserveNoWait(ResourceAllo
> cator.java:347)
>         at
> weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.j
> ava:169)
>         at
> weblogic.jdbc.common.internal.ConnectionPool.reserveNoWait(Connection
> Pool.java:130)
>         at
> weblogic.jdbcbase.common.internal.RmiDataSource.getPoolConnection(Rmi
> DataSource.java:180)
>         at
> weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
> ce.java:49)
>         at ejb.bmp.TaxEJB.getConnection(TaxEJB.java:236)
>         at ejb.bmp.TaxEJB.ejbCreate(TaxEJB.java:34)
>         at ejb.bmp.TaxEJBImpl.ejbCreate(TaxEJBImpl.java:213)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at weblogic.ejb20.manager.DBManager.create(DBManager.java:408)
>         at
> weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:353)
>         at ejb.bmp.TaxEJBHomeImpl.create(TaxEJBHomeImpl.java:75)
>         at
> ejb.bmp.TaxEJBHomeImpl_WLSkel.invoke(TaxEJBHomeImpl_WLSkel.java:66)
>         at
> weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
> va:373)
>
> Earlier what was happening was that only one record was being inserted,
> which got solved after i increased my column width name. But why do i get
> the above exception. Cud anybody give a clue.
>
>
> Regards,
> Vikramjit Singh,
> GTL Ltd.
> Ph. 7612929-1059
>
> ===========================================================================
> To unsubscribe, send email to
[EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
>
[EMAIL PROTECTED] and include in the body of the message "help".
>

Reply via email to