You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Andrew Broderick <an...@gmail.com> on 2010/03/06 19:13:39 UTC

SQL Maps connection mgmt in servlet

Hi,

I am fairly new to iBATIS. I am using SQL Maps v. 2.3.4 in a servlet.

My config is outlined here:

<transactionManager type="JDBC">
    <dataSource type="SIMPLE">
... connection properties
    </dataSource>
</transactionManager>

My DB is PostgreSql.

I have a single SqlMapClient instance as a member variable of the servlet,
initialized in its init() method. Then, multiple clients call its service()
method to generate a report, that consists of many select queries, using the
single SQL map instance.

My questions are:
1) What are the default values for connection pool size? Is it 10?
2) Is SqlMapClient thread-safe?

Thanks,

Andrew

Re: SQL Maps connection mgmt in servlet

Posted by François Schiettecatte <fs...@gmail.com>.
Andrew

The answer is yes, though I am not sure how efficient the simple data source is as pooling, you might want to look at C3P0 which I use ( http://www.mchange.com/projects/c3p0/ ) or DBCP from Apache ( http://commons.apache.org/dbcp/ ).

François


On Mar 6, 2010, at 4:28 PM, Andrew Broderick wrote:

> Good to know, thanks. I'd only used it in conjunction with Spring before, never in a raw servlet, so I wasn't sure.
> 
> How about the connection pooling? Couldn't find it in the documentation, although I'm sure it's in there. Does it release connections to the pool immediately on completion of a query?
> 
> Thanks
> 
> 2010/3/6 François Schiettecatte <fs...@gmail.com>
> Andrew
> 
> Not sure about the first question, but the answer to 2 is yes it is thread safe.
> 
> François
> 
> On Mar 6, 2010, at 1:13 PM, Andrew Broderick wrote:
> 
> > Hi,
> >
> > I am fairly new to iBATIS. I am using SQL Maps v. 2.3.4 in a servlet.
> >
> > My config is outlined here:
> >
> > <transactionManager type="JDBC">
> >     <dataSource type="SIMPLE">
> > ... connection properties
> >     </dataSource>
> > </transactionManager>
> >
> > My DB is PostgreSql.
> >
> > I have a single SqlMapClient instance as a member variable of the servlet, initialized in its init() method. Then, multiple clients call its service() method to generate a report, that consists of many select queries, using the single SQL map instance.
> >
> > My questions are:
> > 1) What are the default values for connection pool size? Is it 10?
> > 2) Is SqlMapClient thread-safe?
> >
> > Thanks,
> >
> > Andrew
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 
> 
> -- 
> Thanks,
> 
> Andrew Broderick


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: SQL Maps connection mgmt in servlet

Posted by Andrew Broderick <an...@gmail.com>.
Good to know, thanks. I'd only used it in conjunction with Spring before,
never in a raw servlet, so I wasn't sure.

How about the connection pooling? Couldn't find it in the documentation,
although I'm sure it's in there. Does it release connections to the pool
immediately on completion of a query?

Thanks

2010/3/6 François Schiettecatte <fs...@gmail.com>

> Andrew
>
> Not sure about the first question, but the answer to 2 is yes it is thread
> safe.
>
> François
>
> On Mar 6, 2010, at 1:13 PM, Andrew Broderick wrote:
>
> > Hi,
> >
> > I am fairly new to iBATIS. I am using SQL Maps v. 2.3.4 in a servlet.
> >
> > My config is outlined here:
> >
> > <transactionManager type="JDBC">
> >     <dataSource type="SIMPLE">
> > ... connection properties
> >     </dataSource>
> > </transactionManager>
> >
> > My DB is PostgreSql.
> >
> > I have a single SqlMapClient instance as a member variable of the
> servlet, initialized in its init() method. Then, multiple clients call its
> service() method to generate a report, that consists of many select queries,
> using the single SQL map instance.
> >
> > My questions are:
> > 1) What are the default values for connection pool size? Is it 10?
> > 2) Is SqlMapClient thread-safe?
> >
> > Thanks,
> >
> > Andrew
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>


-- 
Thanks,

Andrew Broderick

Re: SQL Maps connection mgmt in servlet

Posted by François Schiettecatte <fs...@gmail.com>.
Andrew

Not sure about the first question, but the answer to 2 is yes it is thread safe.

François

On Mar 6, 2010, at 1:13 PM, Andrew Broderick wrote:

> Hi,
> 
> I am fairly new to iBATIS. I am using SQL Maps v. 2.3.4 in a servlet.
> 
> My config is outlined here:
> 
> <transactionManager type="JDBC">
>     <dataSource type="SIMPLE">
> ... connection properties
>     </dataSource>
> </transactionManager>
> 
> My DB is PostgreSql.
> 
> I have a single SqlMapClient instance as a member variable of the servlet, initialized in its init() method. Then, multiple clients call its service() method to generate a report, that consists of many select queries, using the single SQL map instance.
> 
> My questions are:
> 1) What are the default values for connection pool size? Is it 10?
> 2) Is SqlMapClient thread-safe?
> 
> Thanks,
> 
> Andrew


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: SQL Maps connection mgmt in servlet

Posted by François Schiettecatte <fs...@gmail.com>.
Andrew

I should have been more specific, technically it not considered thread safe but it seems to be, at least it has been for me for the past 18 months.

F.

On Mar 6, 2010, at 1:13 PM, Andrew Broderick wrote:

> Hi,
> 
> I am fairly new to iBATIS. I am using SQL Maps v. 2.3.4 in a servlet.
> 
> My config is outlined here:
> 
> <transactionManager type="JDBC">
>     <dataSource type="SIMPLE">
> ... connection properties
>     </dataSource>
> </transactionManager>
> 
> My DB is PostgreSql.
> 
> I have a single SqlMapClient instance as a member variable of the servlet, initialized in its init() method. Then, multiple clients call its service() method to generate a report, that consists of many select queries, using the single SQL map instance.
> 
> My questions are:
> 1) What are the default values for connection pool size? Is it 10?
> 2) Is SqlMapClient thread-safe?
> 
> Thanks,
> 
> Andrew


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org