dev@glassfish.java.net

Re: SQLAnyhwere / Connection Pool

From: Lance J. Andersen <Lance.Andersen_at_Sun.COM>
Date: Tue, 16 Jan 2007 14:20:04 -0500

Markus,

the persistence.xml does not have to change unless you want it to change.

The JNDI name for the data source being used in the persistence unit
within the persistence.xml via
<jta-data-source>the-jndi-name-of-jdbc-resource (for ex:
jdbc/__default)</jta-data-source> can have the connection pool that it
points to changed on the appserver. You can use the admin gui or the
CLI command interface.

What Cheng showed you below from the entry in the domain.xml is what
would change for ASA.:

<jdbc-resource enabled="true" jndi-name="jdbc/__default"
object-type="user" pool-name="DerbyPool"/>


in the line above, you would change the pool-name element value to point
to say ASAPool assuming you configured a Connection Pool for SQL
Anywhere called ASAPool. So pool-name would change from DerbyPool to
ASAPool.

Regards
Lance

Markus KARG wrote:
> Cheng,
>> Markus KARG wrote:
>>> Cheng,
>>>> I usually create a jdbc-connection-pool first, then create a
>>>> jdbc-resource that references that jdbc-connection-pool. If you
>>>> do it in admin gui, it prompts you in each step.
>>>>
>>>> You can look at the jdbc/__default in domain.xml, just for example,
>>>> <jdbc-resource enabled="true" jndi-name="jdbc/__default"
>>>> object-type="user" pool-name="DerbyPool"/>
>>>> DerbyPool is also defined in domain.xml.
>>>>
>>>> You can get more help info by running the 2 asadmin commands:
>>>> asadmin.bat help create-jdbc-connection-pool
>>>> asadmin.bat help create-jdbc-resource
>>> That's not the point. I already had set up a Connection pool and a
>>> jdbc resource, but the question is: How to tell GF that a specific
>>> EJB-module has to be bound to a specific JDBC resource. It is always
>>> using the __default resource, but I want it to use a specific
>>> resource. How to do that?
>>>
>> If your question is about how to specify a jta datasource for a
>> persistence-unit that resides inside a ejb-jar, you can do so in the
>> persistence.xml for this persistence-unit.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>> version="1.0">
>> <persistence-unit name="xxx">
>> <jta-data-source>the-jndi-name-of-jdbc-resource (for ex:
>> jdbc/__default)</jta-data-source>
>> </persistence-unit>
>> </persistence>
> The persistence.xml is part of the original binary, which shall not be
> changed by the administrator. There must be a solution other than
> modifying the original jar, I think. If not, then this feature is
> definitively missing.
>
> Thanks
> Markus