Hi, I didn't try the Encryption Provider method, but the map method solved my problem:
Map<String, String> dbProperties = new HashMap<String, String>(); dbProperties.put("openjpa.ConnectionUserName", dbUserName); dbProperties.put("openjpa.ConnectionPassword", dbPassword); EntityManagerFactory factory = Persistence.createEntityManagerFactory(ENTITY_MANAGER_FACTORY, dbProperties); Here you can find an example: http://foobar.lu/wp/2010/12/30/change-jpa-entitymanager-connection-properties-at-runtime/ Thank you all for your help. -- View this message in context: http://openjpa.208410.n2.nabble.com/Get-database-password-for-persistence-xml-from-external-file-tp7579412p7580268.html Sent from the OpenJPA Users mailing list archive at Nabble.com.