persistence@glassfish.java.net

RE: Re: Question about "switching" JTA datasources in glassfish when using Toplink

From: Kulkarni, Ravi <Ravi_Kulkarni_at_intuit.com>
Date: Fri, 1 Aug 2008 19:03:12 -0700

In my persistence.xml I'm already specifying the JDBC pool name and not
the connection pool name. Sorry, if it was confusing in my original
e-mail.

Here is how we are setting it up:

JDBC Resources:
        JNDI name: Datasource1
        Pool Name: Datasource_pool

Connection Pools:
        Name: Datasource_pool
        ResourceType: javax.sql.DataSource
        DataSource classname:
com.mysql.jdbc.jdbc2.optional.MysqlDataSource


Thanks for responding promptly.
- Ravi

-----Original Message-----
From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
Sent: Friday, August 01, 2008 18:01
To: persistence_at_glassfish.dev.java.net
Subject: Re: Question about "switching" JTA datasources in glassfish
when using Toplink

Hello Ravi,

You can set up 2 jdbc pools in GlassFish, and toggle jdbc-resource
reference to
point to one pool or the other. You might need to restart the glassfish
server
for TopLink to reread the settings and acquire new connections.

Regards,
-marina

Kulkarni, Ravi wrote:
> Hello,
>
>
>
> I've a web service deployed in Glassfish. The Web Service uses Toplink

> for the JPA. One of the requirements from the QA (and engineering
team)
> is that whenever an issue is fixed; they want to first duplicate it in

> the original version of the Web Service and then verify it to be fixed

> in the latest version of the Web Service. The Web Service uses Toplink

> EntityManager and specifies the datasource in the persistence.xml. We
> are trying to see if we can deploy two versions of the Web Service on
> the same server (either under different path, ports or virtual
server).
> However; as the persistence.xml is compiled-in into the .ear; we have
no
> easy way of changing the datasource used by the Web Service. I.e.;
> without re-compiling the source; we want to say that yesterday the Web

> Service was using Datasource1; today the same Web Service should use
> Datasource2. We are okay if we have to restart glassfish to achieve
this
> change.
>
>
>
> We understand that we would also require quite a few databases for
this
> type of support. In my simple example; two; but someone from QA when
> verifying problems reported in multiple versions; may require those
many
> databases.
>
>
>
> What are my options?
>
>
>
> Thanks
>
> - Ravi
>
>
>