Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Relative Path to JDBC-Url
Relative Path to JDBC-Url [message #721772] Fri, 02 September 2011 20:18 Go to next message
Matthias Wegner is currently offline Matthias WegnerFriend
Messages: 8
Registered: September 2011
Junior Member
Hi,

do you know how i can make

<property name="javax.persistence.jdbc.url" value="jdbc:derby:C:\Database\WikiDB;create=true"/>

to the database WikiDB relative? I want to create the database in the User.Dir of the application which should be placed on a usb-device, so i need a relative path to the database.

This is maybe a simple question to JPA, but i dont know how to solve it, so i just post it here because i use EclipseLink. Since two months i am new to JPA, so at the moment i am really happy that my Application is doing what i am expecting Wink I bought books to learn it, but they are not answering all my questions.

Regards,
Matthias
Re: Relative Path to JDBC-Url [message #722694 is a reply to message #721772] Tue, 06 September 2011 14:25 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

The connection information is used by the JDBC driver, so you need to look at your JDBC driver for how this is done. I've never tried it, but Derby says its possible here:
http://db.apache.org/derby/manuals/develop/develop14.html

Best Regards,
Chris
(no subject) [message #722697 is a reply to message #721772] Tue, 06 September 2011 14:25 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

The connection information is used by the JDBC driver, so you need to look at your JDBC driver for how this is done. I've never tried it, but Derby says its possible here:
http://db.apache.org/derby/manuals/develop/develop14.html

Best Regards,
Chris
Re: Relative Path to JDBC-Url [message #797421 is a reply to message #721772] Mon, 13 February 2012 13:17 Go to previous message
Glenn Williams is currently offline Glenn WilliamsFriend
Messages: 1
Registered: February 2012
Junior Member
This is what I use on Windows to accomplish something similar to what you are after:

persistence.xml
---------------
<properties>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="javax.persistence.jdbc.url" value="jdbc:derby:myDB;create=true" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="eclipselink.logging.level" value="FINE"/>
</properties>

Java Code
---------
.
System.setProperty("derby.system.home", System.getProperty("user.home"));
.
database access code
.


The database access code will use the Derby database 'myDB' in the user's home directory.

Hope that helps!

Glenn
Previous Topic:Validation to DDL constraint
Next Topic:EclipseLink JPA Multi-Tenancy - Bidirectional OneToOne - ArrayIndexOutOfBoundsException
Goto Forum:
  


Current Time: Thu Apr 25 04:07:46 GMT 2024

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

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

Back to the top