dynamically configure javax.persistence.jdbc.url? [message #531822] |
Thu, 06 May 2010 05:55  |
Eclipse User |
|
|
|
Hi,
I'm writing a desktop app in Jave SE and want to be able to enable the users to change the embedded JavadDB database they are working from on the fly.
Does any know if there is a way to pgramatically change the value of javax.persistence.jdbc.url and effectively restart the app?
I guess the longer (possibly "proper") way of doing this would be to make the modification/dB selection from a separate launcher app which makes the change to the url and restarts the main windown app.....anyone know a framework for doing this?
thanks,
|
|
|
Re: dynamically configure javax.persistence.jdbc.url? [message #531834 is a reply to message #531822] |
Thu, 06 May 2010 06:16   |
Eclipse User |
|
|
|
On 2010-05-06 11:55, Olu wrote:
> Hi,
> I'm writing a desktop app in Jave SE and want to be able to enable the
> users to change the embedded JavadDB database they are working from on
> the fly.
>
> Does any know if there is a way to pgramatically change the value of
> javax.persistence.jdbc.url and effectively restart the app?
>
> I guess the longer (possibly "proper") way of doing this would be to
> make the modification/dB selection from a separate launcher app which
> makes the change to the url and restarts the main windown app.....anyone
> know a framework for doing this?
>
> thanks,
Like this?
Map<String, Object> lOptions = new HashMap<String, Object>();
lOptions.put(PersistenceUnitProperties.JDBC_DRIVER, lDriver);
lOptions.put(PersistenceUnitProperties.JDBC_URL, lUrl);
lOptions.put(PersistenceUnitProperties.JDBC_USER, lUsr);
lOptions.put(PersistenceUnitProperties.JDBC_PASSWORD, lPwd);
lOptions.put(PersistenceUnitProperties.TARGET_DATABASE, "Informix");
lOptions.put(PersistenceUnitProperties.TARGET_SERVER, TargetServer.None);
EntityManagerFactory lEntityManagerFactory = Persistence.createEntityManagerFactory("xxxx", lOptions);
|
|
|
|
Powered by
FUDForum. Page generated in 0.07300 seconds