JPA Persistence with embedded derby database possible?

255 views
Skip to first unread message

cal

unread,
Mar 15, 2015, 3:23:15 PM3/15/15
to ope...@googlegroups.com
Moin!

I currently use rrd4j and influxdb persistence.
I would like to give derby persistence using embedded database a try but could not get it running.

openhab.cfg:
jpa:url=jdbc:derby:openhab.derby;create=true
jpa:driver=org.apache.derby.jdbc.EmbeddedDriver
jpa:user=root
jpa:password=root

jpa.persist created.

No matter what I did including osgi classpath hacks I always got a

Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
 
Any idea?

Carsten

Manfred Bergmann

unread,
Mar 16, 2015, 4:11:34 AM3/16/15
to ope...@googlegroups.com
Should generally work.
I don't haveaccess to the binding right now. Could you extract the binding and check whether the embedded driver is included?
All db libs are inside the binding.

Manfred

cal

unread,
Mar 16, 2015, 6:03:27 AM3/16/15
to ope...@googlegroups.com
Hi Manfred,

as I would expect it only the derbyclient.jar is included.
Using the embedded driver means running derby inside openhab vm means the whole derby-library containing the database is needed.
That should'nt be in the JPA-Bundle IMHO.
So I guess what we need here is a fragment(?) bundle containing the derby database?
Than if you want embedded derby you copy that bundle to addons-directory.
Never build one myself but found maven examples.
I thought I could avoid doing it right. ;-)

Thanks for the JPA bundle!

Carsten

Manfred Bergmann

unread,
Mar 16, 2015, 1:36:02 PM3/16/15
to ope...@googlegroups.com
I think for the purpose to be able to use the embedded driver it would be ok to include the full derby lib to the bindung.
I'm not sure if there is another way of extending the classpath of openhab/osgi.


Manfred

cal

unread,
Mar 16, 2015, 1:50:35 PM3/16/15
to ope...@googlegroups.com

As far as I understand that fragment bundles can be used here:

http://wiki.osgi.org/wiki/Fragment

I looked for OSGI solutions for JDBC driver use and that lead me to fragment bundles.

About 3 MB extra jars which are not used by most users? *I* would try to make a fragment but can't look into this until next weekend.

Manfred Bergmann

unread,
Mar 16, 2015, 4:56:35 PM3/16/15
to ope...@googlegroups.com
Knowing how this would generally work would be good, also for supporting other databases through jpa.
So, great if you can look into that.


Manfred

Manfred Bergmann

unread,
Aug 9, 2015, 7:25:05 AM8/9/15
to openhab
Just for the record, it seems quite easy to extend the openhab classpath.

Using this line in start(_debug).sh instead of the original extends the classpath with all jars in the given folder:
cp=$(echo lib/*.jar | tr ' ' ':'):$(find $eclipsehome -name "org.eclipse.equinox.launcher_*.jar" | sort | tail -1);

Manfred
Reply all
Reply to author
Forward
0 new messages