Skip to main content



      Home
Home » Eclipse Projects » Gemini » Gemini JPA / DBAccess - best way to configure JDBC properties?(How can I maintain DB connection info in a separate properties file?)
Gemini JPA / DBAccess - best way to configure JDBC properties? [message #1002312] Fri, 18 January 2013 06:36 Go to next message
Eclipse UserFriend
I've just migrated an OSGi application to Gemini JPA / DBAccess with MySQL, running on Virgo 3.6. Currently I have the jdbc connection property values set in the persistence.xml file. Is it possible to store these properties in a separate configuration file? I'd like to change files for different environments e.g. development, production.

Previously, I had my own OSGi bundle which created a datasource using a C3P0 connection pool. This used a property-placeholder bean which referenced a configuration artefact loaded by Virgo:

<!--  Create a connection pool data source (using C3P0 lib) for the DB -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
             p:driverClass="${db.driverClass}"
             p:jdbcUrl="${db.url}"
             p:user="${db.username}"
             p:password="${db.password}"
             />

     <context:property-placeholder properties-ref="configProperties"/>

     <osgi-compendium:cm-properties id="configProperties" persistent-id="db_config"/>

     <!-- ========================= OSGi SERVICES ========================= -->

     <osgi:service ref="dataSource" interface="javax.sql.DataSource"/>
Re: Gemini JPA / DBAccess - best way to configure JDBC properties? [message #1002376 is a reply to message #1002312] Fri, 18 January 2013 08:32 Go to previous messageGo to next message
Eclipse UserFriend
First, Gemini JPA supports multiple persistence descriptors so you can break things up statically that way.
Second, there is support for dynamic definition using the OSGi config admin service. See http://wiki.eclipse.org/Gemini/JPA/Documentation/OtherTopics#Configuration_Admin

-Mike
Re: Gemini JPA / DBAccess - best way to configure JDBC properties? [message #1003604 is a reply to message #1002312] Mon, 21 January 2013 10:45 Go to previous message
Eclipse UserFriend
Thanks Mike. I will investigate using the config admin service.
Previous Topic:Gemini JPA and Spring
Next Topic:List of Services: Wait for all Services?
Goto Forum:
  


Current Time: Mon Apr 28 06:26:08 EDT 2025

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

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

Back to the top