ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Conections Opened
Date Fri, 11 Aug 2006 15:58:46 GMT
I don't know what your other issue was, but if you look in the developer's
guide for "Automatic Transactions" you'll see that we claim that iBATIS will
call these methods automatically for you if you don't call them yourself.  I
can vouch that automatic transacations work in my code.

Maybe there was some other bug in play?

Jeff Butler



On 8/11/06, Chen, Tim <Tim.Chen@nielsenmedia.com> wrote:
>
>  I dont know jeff. larry will probably yell at me earlier if this is true.
> but i know that i had the same problem till i started wrapping my code
> with:
>
> .startTransaction();
> .endTransaction();
>
>
>
>  ------------------------------
> *From:* Jeff Butler [mailto:jeffgbutler@gmail.com]
> *Sent:* Friday, August 11, 2006 11:35 AM
>
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: Conections Opened
>
>
>  iBATIS handles opening and closing of connections automatically - this is
> one of the reasons you use a framework like iBATIS!  You only need to 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 <Tim.Chen@nielsenmedia.com> 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<AdStandard> selectAdStandards() throws DaoException
> > {
> >         return queryForList("AD_STANDARD.selectAdStandards", null);
> >     }
> >
> > Does Ibatis open/closes the connection by it´s 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 <Tim.Chen@nielsenmedia.com > wrote:
> > >
> > >  1) I dont know about daoMgr. You should check the AdStandardDAO 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 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.StartTransactionand always
> > > daoMgr.EndTransaction. But in simple querys like above, Do I need to
> > > daoMgr.EndTransation?
> > >
> > > try{
> > >             adStandardDAO = (AdStandardDAO) daoMgr.getDao(
> > > AdStandardDAO.class);
> > >             return adStandardDAO.selectAdStandards();
> > >         }
> > >         catch(DaoException e)
> > >         {
> > >             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 know any problem
> > > related with this container? For a while we can´t use JNDI. :(.
> > >
> > > When I startup Ibatis (create a instance of DaoMgr), should it open
> > > the InitialSize number of connections? Because it´s not creating. Only if
I
> > > call a query.
> > >
> > > tks!
> > >
> > >
> > >
> > >
> > >
> > > On 8/11/06, Chen, Tim <Tim.Chen@nielsenmedia.com > wrote:
> > > >
> > > >  1) have you closed your connections in a finally block? opening a
> > > > new connection for each call is sever.. it *should* be getting some
> > > > connections from the pool.
> > > > 2) have you tried playing with maxRequests in <settings>?
> > > > 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. And 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 <Aram.Mkhitaryan@lycos-europe.com >
> > > > 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.
> > > > >
> > > > >  <transactionManager type="JDBC">
> > > > >     <dataSource type="DBCP">
> > > > >       <property value="${database_driver}" name=" JDBC.Driver"/>
> > > > >       <property value="${database_url}" name="JDBC.ConnectionURL"/>
> > > > >       <property value="${database_user}" name="JDBC.Username"/>
> > > > >       <property value="${database_password}" name=" JDBC.Password
> > > > > "/>
> > > > >       <property value="10" name=" Pool.MaximumActiveConnections"/>
> > > > >       <property value="5" name="Pool.MaximumIdleConnections"/>
> > > > >       <property value="6000" name=" Pool.MaximumWait"/>
> > > > >     </dataSource>
> > > > >   </transactionManager>
> > > > >
> > > > > 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:
> > > > > <property value="1" name=" Pool.MaximumActiveConnections"/>
> > > > > <property value="1" name="Pool.MaximumIdleConnections"/>
> > > > > But Ibatis open 4 connections at least.
> > > > >
> > > > > Cheers!
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
>

Mime
View raw message