Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » dynamically configure javax.persistence.jdbc.url?(How to change an embedded dB on the fly)
dynamically configure javax.persistence.jdbc.url? [message #531822] Thu, 06 May 2010 05:55 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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);
Re: dynamically configure javax.persistence.jdbc.url? [message #532334 is a reply to message #531834] Sat, 08 May 2010 09:00 Go to previous message
Eclipse UserFriend
thanks - looks good and will try it out.
Previous Topic:[Unidirectional OneToOne Relationships] eclipselink doesn't understand MapsId=" "
Next Topic:CreateNativeQuery ResultSet mapping
Goto Forum:
  


Current Time: Tue Jul 22 18:48:53 EDT 2025

Powered by FUDForum. Page generated in 0.07300 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top