Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 67763 invoked from network); 11 Aug 2006 19:28:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2006 19:28:18 -0000 Received: (qmail 12855 invoked by uid 500); 11 Aug 2006 19:28:17 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 12569 invoked by uid 500); 11 Aug 2006 19:28:16 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 12558 invoked by uid 99); 11 Aug 2006 19:28:16 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2006 12:28:16 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of renatosilveira@gmail.com designates 66.249.82.237 as permitted sender) Received: from [66.249.82.237] (HELO wx-out-0506.google.com) (66.249.82.237) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2006 12:28:15 -0700 Received: by wx-out-0506.google.com with SMTP id h30so902702wxd for ; Fri, 11 Aug 2006 12:27:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=MLoUAbrnpikUqJwmKFBAOvF7m6KpzsVxJmjOvj9IJLXZA79iciGmPM9wlqrPdG5ur0fG7Mx3JmvXKYXc2GlQwpyU/Rf8CWnUPQGzQQIMxn+m5VdxPCQh7Bi9C37bT22weUcEIZDz1H8MZ1zPlmMbhVXrlQvnyIVuF9+npG9ThHo= Received: by 10.78.151.15 with SMTP id y15mr2317127hud; Fri, 11 Aug 2006 12:27:52 -0700 (PDT) Received: by 10.78.117.17 with HTTP; Fri, 11 Aug 2006 12:27:52 -0700 (PDT) Message-ID: Date: Fri, 11 Aug 2006 16:27:52 -0300 From: "Renato Silveira" To: user-java@ibatis.apache.org Subject: Re: Conections Opened In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_144612_4887961.1155324472797" References: <093D7E25FD9C2441A13103EFB8CBED3A0BB408CE@nmr001oldmsx04.enterprisenet.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_144612_4887961.1155324472797 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Problem is solved! Although I sad that there was only one instance of DaoManager, I discovered that the singleton was bugged and returned a new instance of DaoManager eac= h time. Tks everybody! On 8/11/06, Renato Silveira wrote: > > Jeff, > > That is exactly what I=B4m doing. Only if I startTransaction I use the > endTransation in the other cases, Ibatis should do it, right? > > When I startUp Ibatis (create the first instance of DaoManager Class). Th= e > connections of the pool should be opened? Because, it=B4s not happening. = Only > when I call a method like a queryForObject one it=B4s opened. Is that rig= ht? > > I=B4m building an persistence API using Ibatis. In my standalone tests wh= en > I call a method it open a new connection. If make a second call the app u= ses > the same connection. That=B4s ok. But using this in a webapp it seens to > create a new connection for every single call. > > This is how my sql-map-config is configured. > > > > > > > > > > > > > > > tks! > > > > > On 8/11/06, Jeff Butler < jeffgbutler@gmail.com> wrote: > > > > iBATIS handles opening and closing of connections automatically - this > > is one of the reasons you use a framework like iBATIS! You only need t= o > > close a connection if you open it explicitly (vary rare in iBATIS). > > > > You do need to end transactions, but again only if you start > > transactions. If you don't write a startTransaction method, then the > > transaction is automatic and you don't need to write an endTransaction > > method. > > > > So something else is strange here. > > > > Jeff Butler > > > > > > > > > > > > On 8/11/06, Chen, Tim wrote: > > > > > > you have to close it explicitly. look at ibatis examples and you'll > > > see how. > > > > > > ------------------------------ > > > *From:* Renato Silveira [mailto:renatosilveira@gmail.com] > > > *Sent:* Friday, August 11, 2006 10:55 AM > > > > > > *To:* user-java@ibatis.apache.org > > > *Subject: * Re: Conections Opened > > > > > > > > > 1) This is the code of my AdStandardDAO.selectAdStandards() > > > public Collection selectAdStandards() throws > > > DaoException { > > > return queryForList("AD_STANDARD.selectAdStandards", null); > > > } > > > > > > Does Ibatis open/closes the connection by it=B4s own? Should I close > > > explicit? How do I do that? > > > > > > 2) The MaxNumber of connections is 20. The error ocurrs when this is > > > reached. > > > > > > tks! > > > > > > > > > > > > On 8/11/06, Chen, Tim wrote: > > > > > > > > 1) I dont know about daoMgr. You should check the AdStandardDAO > > > > code for selectAdStandards() and make sure that it closes the conne= ction > > > > that it gets. > > > > 2) yes > > > > 3) you didn't answer my question lol. you need to see how many > > > > active connections the dba has given you and how many are open when= the > > > > error occurs. > > > > 4) i'm not sure why not.. look up creating a connection pool in > > > > jetty. > > > > > > > > ------------------------------ > > > > *From:* Renato Silveira [mailto:renatosilveira@gmail.com] > > > > *Sent:* Friday, August 11, 2006 10:22 AM > > > > > > > > *To:* user-java@ibatis.apache.org > > > > *Subject:* Re: Conections Opened > > > > > > > > > > > > 1) In querys that involves transactions I use > > > > daoMgr.StartTransaction and always daoMgr.EndTransaction. But in > > > > simple querys like above, Do I need to daoMgr.EndTransation? > > > > > > > > try{ > > > > adStandardDAO =3D (AdStandardDAO) daoMgr.getDao( > > > > AdStandardDAO.class); > > > > return adStandardDAO.selectAdStandards(); > > > > } > > > > catch(DaoException e) > > > > { > > > > throw new ServiceException(e); > > > > } > > > > > > > > 2) have you tried playing with maxRequests in ? > > > > No, should I do this in SQL-MAP-Config ? > > > > > > > > 3) In SQL-MAP-Config I set maxActive in 10. > > > > > > > > 4) The container we are using is jetty. Do you know any problem > > > > related with this container? For a while we can=B4t use JNDI. :(. > > > > > > > > When I startup Ibatis (create a instance of DaoMgr), should it open > > > > the InitialSize number of connections? Because it=B4s not creating.= Only if I > > > > call a query. > > > > > > > > tks! > > > > > > > > > > > > > > > > > > > > > > > > On 8/11/06, Chen, Tim wrote: > > > > > > > > > > 1) have you closed your connections in a finally block? opening = a > > > > > new connection for each call is sever.. it *should* be getting so= me > > > > > connections from the pool. > > > > > 2) have you tried playing with maxRequests in ? > > > > > 3) how many connections before the error msg? (have a dba check > > > > > for you if you aren't sure) is it possible that you just have the= limit set > > > > > too high? > > > > > 4) if all else fails use a JNDI connection and setup the > > > > > connection pool within your container. > > > > > > > > > > ------------------------------ > > > > > *From:* Renato Silveira [mailto:renatosilveira@gmail.com] > > > > > *Sent:* Friday, August 11, 2006 9:52 AM > > > > > > > > > > *To:* user-java@ibatis.apache.org > > > > > *Subject:* Re: Conections Opened > > > > > > > > > > > > > > > I still have this problem. Every single call I made a new > > > > > connection is opened. The DaoManager is started just one time. An= d the > > > > > connection remain opened for a long time until oracle returns a = error of > > > > > max number of connections opened. > > > > > > > > > > Any ideas to solve this problem? > > > > > > > > > > tks! > > > > > > > > > > > > > > > > > > > > > > > > > On 8/11/06, Mkhitaryan, Aram > > > > > wrote: > > > > > > > > > > > > When you do first call DBCP creates minimum number of > > > > > > connections > > > > > > > > > > > > and uses these connections until all connections are > > > > > > busy(active/running) and new connection is created. > > > > > > > > > > > > > > > > > > > > > > > > If you compare first call and second, the first one should take > > > > > > much time then second one. > > > > > > > > > > > > > > > > > > > > > > > > But if "every call I do a new connection is created " that only > > > > > > can mean that your calls are too fast and DBCP > > > > > > > > > > > > can't create connections automatically and creates during call. > > > > > > > > > > > > > > > > > > > > > > > > Best, > > > > > > > > > > > > Aram > > > > > > > > > > > > > > > > > > ------------------------------ > > > > > > > > > > > > *From:* Renato Silveira [mailto: renatosilveira@gmail.com] > > > > > > *Sent: *Friday, August 11, 2006 3:45 AM > > > > > > *To:* user-java@ibatis.apache.org > > > > > > * Subject:* Re: Conections Opened > > > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > I have configured the maxActive connection with 10 but every > > > > > > call I do a new connection is created. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > JDBC.Password"/> > > > > > > > > > > > "/> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > This is my SQL-map-config like. How do I limit the number of > > > > > > opened connections? > > > > > > > > > > > > tks! > > > > > > > > > > > > On 8/10/06, *Renato Silveira* < renatosilveira@gmail.com> wrote= : > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > How many connections are opened by Ibatis to make a simple > > > > > > query? > > > > > > > > > > > > In my sql-map-config, using SimpleDataSource (pool), the > > > > > > maxnumber of connection are like this: > > > > > > > > > > > > > > > > > > But Ibatis open 4 connections at least. > > > > > > > > > > > > Cheers! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------=_Part_144612_4887961.1155324472797 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Problem is solved!
Although I sad that there was only one instance of D= aoManager, I discovered that the singleton was bugged and returned a new in= stance of DaoManager each time.

Tks everybody!



On 8/11/06, Renat= o Silveira <renatosilvei= ra@gmail.com > wrote:
Jeff,

That is exactly what I=B4m doing. Only if I startTransac= tion I use the endTransation in the other cases, Ibatis should do it, right= ?

When I startUp Ibatis (create the first instance of DaoManager Cl= ass). The connections of the pool should be opened? Because, it=B4s not hap= pening. Only when I call a method like a queryForObject one it=B4s opened. = Is that right?

I=B4m building an persistence API using Ibatis. In my standalone te= sts when I call a method it open a new connection. If make a second call th= e app uses the same connection. That=B4s ok. But using this in a webapp it = seens to create a new connection for every single call.=20

This is how my sql-map-config is configured.

<transactionManager type=3D"JDBC">
    = <dataSource type=3D"DBCP">
     = ; <property value=3D"${database_driver}" name=3D" JDBC.Driver"/>
      <property value= =3D"${database_url}" name=3D"JDBC.ConnectionURL"/>      <property value=3D"${database_user= }" name=3D"JDBC.Username"/>
    &n= bsp; <property value=3D"${database_password}" name=3D" JDBC.Password"/>
      <property val= ue=3D"10" name=3D"Pool.MaximumActiveConnections"/>      <property value=3D"5" name=3D= "Pool.MaximumIdleConnections"/>
    &nb= sp; <property value=3D"6000" name=3D" Pool.MaximumWait"/>
    </dataSource>
&n= bsp; </transactionManager>

tks!




On 8/11/06,=20 Jeff Butler < jeffgbutler@gmail.com> wrote:
iBATIS handles opening and closing of c= onnections automatically - this is one of the reasons you use a framework l= ike iBATIS!  You only need to close a connection if you open it e= xplicitly (vary rare in iBATIS).
 
You do need to end transactions, but again only if you start transacti= ons.  If you don't write a startTransaction method, then the transacti= on is automatic and you don't need to write an endTransaction method.
 
So something else is strange here.
 
Jeff Butler
 
 


 
On 8/11/06, = Chen, Tim <Tim.Chen@nie= lsenmedia.com > wrote:
you have to close it explicitly. look at ibatis examples and y= ou'll see how.


From: Renato Silveira [mailto:renatosilveira@gmail.com]
Sent: Friday, August 11, 2006 10:55 AM

To: us= er-java@ibatis.apache.org
Subject: Re: Conections Opened

 
1) This is the code of my AdStandardDAO.selectAdStandards()
&= nbsp;  public Collection<AdStandard> selectAdStandards() throws = DaoException {
        return queryForList= ("AD_STANDARD.selectAdStandards", null);=20
    }

Does Ibatis open/closes the connection by i= t=B4s own?  Should I close explicit? How do I do that?

2) The M= axNumber of connections is 20. The error ocurrs when this is reached.
tks!



On 8/11/06, = Chen, Tim <Tim.Chen@nie= lsenmedia.com > wrote:=20
1) I dont know about daoMgr. You should check the AdStandardDA= O code for selectAdStandards() and make sure that it closes the connection = that it gets.
2) yes
3) you didn't answer my question lol. you need to see how many= active connections the dba has given you and how many are open when the er= ror occurs.
4) i'm not sure why not.. look up creating a connection pool i= n jetty.


From: Renato Silveira [m= ailto:renatosilveira@gmail.com<= /a>]=20
Sent: Friday, August 11, 2006 = 10:22 AM

To:
user-java@ibatis.apache.org
Subjec= t: Re: Conections Opened

 
1) In querys that involves transactions I use daoMgr.StartTransa= ction and always daoMgr.EndTransaction. But in simple querys like above, Do= I need to daoMgr.EndTransation?

try{
     &n= bsp;      adStandardDAO =3D (AdStandardDAO)=20 daoMgr.getDao(AdStandardDAO.class);
       = ;     return adStandardDAO.selectAdStandards();
 &nb= sp;      }
        cat= ch(DaoException e)
        {
 &nbs= p;          throw new ServiceException(e= );
        }

2) have you tried playing with maxRequests in <settings>= ?
No, should I do this in SQL-MAP-Config ?

3) In SQL-MAP-Config I set = maxActive in 10.

4) The container we are using is jetty. Do you kno= w any problem related with this container? For a while we can=B4t use JNDI.= :(.=20

When I startup Ibatis (create a instance of DaoMgr), should it open= the InitialSize number of connections? Because it=B4s not creating. Only i= f I call a query.

tks!





On 8/11/06, = Chen, Tim <Tim.Chen@nie= lsenmedia.com > wrote:=20
1) have you closed your connections in a finally block? openin= g a new connection for each call is sever.. it *should* be getting some con= nections from the pool.
2) have you tried playing with maxRequests in <settings>= ?
3) how many connections before the error msg? (have a dba chec= k for you if you aren't sure) is it possible that you just have the limit s= et too high?
4) if all else fails use a JNDI connection and setup the conne= ction pool within your container.


From: Renato Silveira [m= ailto:renatosilveira@gmail.com<= /a>]=20
Sent: Friday, August 11, 2006 = 9:52 AM

To:
user-java@ibatis.apache.org
Subjec= t: Re: Conections Opened

 
I still have this problem. Every single call I made a new connec= tion is opened. The DaoManager is started just one time. And the connection= remain opened for a  long time until oracle returns a error of max nu= mber of connections opened.=20

Any ideas to solve this problem?

tks!




On 8/11/06, = Mkhitaryan, Aram <

 

Hi,

I have configured the maxActi= ve connection with 10 but every call I do a new connection is created.
=
 <transactionManager type=3D"JDBC">
    <dataSource type=3D"DBCP">
 =      <property value=3D"${database_driver}"= ; name=3D" JDBC.Driver"/>
      &l= t;property value=3D"${database_url}" name=3D"JDBC.Connection= URL "/>
      <property value=3D"${= database_user}" name=3D"JDBC.Username"/>
  &= nbsp;   <property value=3D"${database_password}" nam= e=3D" JDBC.Password"/>
      <p= roperty value=3D"10" name=3D" Pool.MaximumActiveConnections"/>
      = <property value=3D"5" name=3D"Pool.MaximumIdleConnections= "/>
      <property value=3D"60= 00" name=3D" Pool.MaximumWait"/>
    </dataSource>
  </transactionManager>= ;

This is my SQL-map-config like. How do I limit the number of opene= d connections?

tks!

On 8/10/06, Renato Silveira<= /span> < renatosilveira@gmail.com> wrote:

Hi,

How many connections are opene= d by Ibatis to make a simple query?

In my sql-map-config, using Sim= pleDataSource (pool), the maxnumber of connection are like this:
<property value=3D"1" name=3D" Pool.MaximumActiveConn= ections"/>
<property value=3D"1" name=3D"Pool= .MaximumIdleConnections"/>
But Ibatis open 4 connections at lea= st.

Cheers!

 







------=_Part_144612_4887961.1155324472797--