db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Embedded Derby + J2ME + JDBC Connection Pooling
Date Thu, 09 Oct 2008 08:15:09 GMT
Paul French <paul.french@kirona.com> writes:

> Hello All,
>  
> I create an EmbeddedSimpleDataSource in my code. My application is
> multi-threaded. I assume EmbeddedSimpleDataSource is thread safe from the
> point of view of obtaining connections.
>  
> What is the cost of getting a connection each time I need to do some database
> work? (Derby is running embedded in my application)
>  
> If the cost is high then I would like to use a light weight Connection Pool
> Manager similar to Apache Commons DBCP, any ideas of a good implementation
> that works on J2ME Personal Profile 1.1.2

Creating connections in embedded Derby is a very cheap operation
compared to creating connections to a database server over the network,
so you won't see the same performance improvements with connection
pooling as in a traditional database environment. There is a one-time
cost when you set up a connection (creating the connection object,
transaction object, context stack, etc.) that you will save if you have
a pool. Whether or not it's worth it depends on how frequently your
application creates a new connection. If it does it once every five
seconds, I doubt that you'll notice the difference. If it creates many
connections (like tens or hundreds) per second, you'll be more likely to
see an improvement.

-- 
Knut Anders

Mime
View raw message