dev@glassfish.java.net

Re: SQLAnyhwere / Connection Pool

From: Markus KARG <markus.karg_at_gmx.net>
Date: Wed, 17 Jan 2007 21:50:24 +0100

So do I understand it right:

If persistence.xml does not contain jta-data-source then it will be
using jdbc/__default always? And if I want it to use another source,
then it MUST contain jta-data-source? Isn't there some "implicit"
mechanism, e. g. having the persistence.xml's name mapped to a jdbc data
source of the same name?

Markus

Lance J. Andersen schrieb:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>