Hi. I am trying to use glassfish fot persistence. The database I am using is Oracle 10g XE. I configured the persistence.xml file, but it doesn't work. I think TopLink is trying to connect to (the default Derby??) database on localhost on port 1527. Pleasee see my config file:
[code]
<persistence-unit name="TestEJB">
<properties>
<property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver" />
<property name="toplink.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:XE" />
<property name="toplink.jdbc.user" value="rafal" />
<property name="toplink.jdbc.password" value="duuuh"/>
<property name="toplink.logging.level" value="FINEST"/>
</properties>
</persistence-unit>
[/code]
The root cause of the problems I have is the following:
[code]
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/17/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused.
Error Code: 0
[/code]
The EntityManager is injected like this:
[code]
@PersistenceContext(unitName = "TestEJB")
private EntityManager em;
[/code]
The database does work, I can both test the connection in Eclipse, and connect to the db from a simple test application in JavaSE.
When I check the logs, it turns out that TopLink is using the user, password and logging level, but the driver class or jdbc url are not mentioned anywhere in the log output. What needs to be done so that it starts working? Any link will be helpful.
Thank you.
[Message sent by forum member 'szczyp' (szczyp)]
http://forums.java.net/jive/thread.jspa?messageID=317320