commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: Create Serializable DataSource and DataSourceFactory
Date Tue, 30 Nov 2004 17:08:59 GMT
It's not possible to make BasicDataSource serializable, because the
underlying JDBC "Connection" objects that it holds are not
serializable.  So, that begs the question of why you care about this.

The only reason I can think of is that you want to store such an
object in session scope in a web application.  If so, you might want
to think about using appication scope instead (and share the pool
across all your users), or use the JNDI-accessible JDBC data sources
that are provided by your server.  For example, Tomcat uses Commons
DBCP (and the BasicDataSource) as its implementation of this feature:

Other servers have different ways to configure these data sources, but
the programming examples shown on these pages will be portable.


On Tue, 30 Nov 2004 14:34:18 +0000, lydie soler <> wrote:
> Hi,
> I am quite new at DBCP. For the moment I am using the classes
> BasicDataSource and BasicDataSourceFactory. But they are not
> serializable.... and I would need them to be...
> Has anyone developped a serializable version? The behaviour of these classes
> is just perfect for me. So If possible I would prefer not rewrite them
> Thanks for your help
> Lydie
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message