I have a problem where DB2 access requires hard coded ConnectionUserName
and ConnectionPassword properties in the persistence.xml and other databases (like MySQL) do not. This is a problem, becuase I don't want
to edit those files after I deploy when the database password expires...I want to manage it only through the Admin console.
Here's the background:
I've been using JPA with MySQL 5.1 for a client, and am now switching to DB2. I'm using WebSphere 220.127.116.11 as a websphere WTE under RSA 18.104.22.168.
MySQL works fine - the J2C Auth data in the server's resources.xml is used
to connect to the database.
In my code, I'm using EntityManagerFactory code to look up the perstistence Unit name EntityManagerFactory emf = Persistence
.createEntityManagerFactory("PUName"); to get the data. In the Admin console,a "Test Connection" works fine.
For DB2, I've generated the persistence.xml
and orm.xml using the tooling's JPA Content->Configure for JDBC deployment
The problem is that, for DB2 to work in this environment,
I'm having to manually add the following parameters to the persistence.xml
<property name="openjpa.ConnectionUserName" value="db2inst1" />
<property name="openjpa.ConnectionPassword" value="<password for db2inst1>" />
If I have to specify the ConnectionUserName and password in the persistence.xml, then when the password changes, I'll have to manually edit
this file on the deployed server...which won't work for production.
Why doesn't the persistence.xml get this information from the resources
definition? It's obviously finding the server name and similar there.
I've attached a (slightly hidden -password omitted) persistence.xml in the attachments - any pointer will help
This topic has been locked.
Pinned topic DB2 JPA via JNDI requiring login info in persistence.xml
Answered question This question has been answered.
Unanswered question This question has not been answered yet.