Re: BUG #1065: JDBC DataSource Serializability

From: Kris Jurka <books(at)ejurka(dot)com>
To: <rslemos(at)nce(dot)ufrj(dot)br>
Cc: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #1065: JDBC DataSource Serializability
Date: 2004-01-26 13:22:34
Message-ID: Pine.LNX.4.33.0401260716210.18726-200000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> The following bug has been logged online:
>
> Bug reference: 1065
> Logged by: R. Lemos
>
> The JDBC2 pooled datasource(org.postgresql.jdbc2.optional.ConnectionPool),
> although implements java.io.Serializable, cannot be correctly serialized.
> Its superclass does not implement java.io.Serializable and have important
> fields marked as private.

The BaseDataSource class cannot be made Serializable because one of its
subclasses (PoolingDataSource) cannot be serialized. The
PoolingDataSource class has member variables which can contain active
database connections which can't be persisted.

> Either should the superclass be Serializable or its fields non-private
> (protected, friend or public).
>

Simply marking the fields with a weaker access level won't magically
persist them. This requires manually using writeObject and
readObject. This problem also occurs in SimpleDataSource. I've
attached the patch I've applied to the gborg cvs repository.

Thanks for the report.

Kris Jurka

Attachment Content-Type Size
ds_serialize.patch text/plain 6.4 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-01-26 16:51:45 Re: Postgres 7.4.1 "make check" failed "stats" test on Solaris 2.6
Previous Message PostgreSQL Bugs List 2004-01-25 09:20:18 BUG #1066: avg(age()) results months with more than 30 days