Search code examples
eclipseeclipse-rcprcpe4

How to load database configuration from preferences in eclipse e4 rcp?


I am trying to load and use my database configuration from preferences as suggested here using properties = {...} approach, but it is not working.

I get the following exception:

WARNING: EMFProxy invocation on method isOpen failed:  Exception: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.0.v20130815-a4708b6): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: URL was not specified

The problem persists even if I hard code the values in properties using value=.... It somehow does not read the properties.


Solution

  • I fixed it! I wanted the PersistenceUnitProperties.JDBC_DRIVER to be static so I left it in the persistence.xml and did not add it programmatically. The problem was fixed when I removed it from persistence.xml and set it also programmatically.