users@glassfish.java.net

Re: Not Connecting to Database

From: <glassfish_at_javadesktop.org>
Date: Thu, 23 Aug 2007 10:19:21 PDT

Russ,

Is it the same persistence.xml as in your other thread? That version had also <jta-data-source>jdbc/databsename</jta-data-source> (check the spelling of the jndi name).

How are you acquiring an EMF? Unless you call Persistence.createEMF() (and even in that case) if you have both, the ...-data-source and the jdbc properties, in the Java EE container the ...-data-source will be used. If you lookup or inject EM/EMF, even if you do not specify that ...-data-source entry, it will be added for you automatically by the container, and point to the default datasource (derby in GlassFish).

To use you own, you need to create the datasource with the above jndi name in the appserver.

HTH,
-marina
[Message sent by forum member 'mvatkina' (mvatkina)]

http://forums.java.net/jive/thread.jspa?messageID=232360