dev@glassfish.java.net

Re: SQLAnyhwere / Connection Pool

From: Markus KARG <markus.karg_at_gmx.net>
Date: Tue, 16 Jan 2007 19:02:52 +0100

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