Solved

Hibernate XML Configuration file and application path

Posted on 2006-12-01
3
337 Views
Last Modified: 2008-02-01
I am using firebird's embedded database(or trying to atleast) with my application.  I want to be able to set the path to the database relative to my application for instance normally outside of hibernate i could do something like this:

String dir = System.getProperty("user.dir");
            Connection con = null;
            Driver d = (Driver)Class.forName( "org.firebirdsql.jdbc.FBDriver" ).newInstance();
            con = DriverManager.getConnection("jdbc:firebirdsql:embedded:" +dir + "\\USERDB.FDB", "sysdba", "masterkey");

I can't figure out how i would get hibernate to recognize the working directory of the application in it's xml configuration file I would like to do something similar to below where %ApplicationDIR% would be the application directory.  Is this possible?

<property name="hibernate.connection.url">jdbc:firebirdsql:embedded:%ApplicationDIR%USERDB.FDB</property>
     
           
0
Comment
Question by:ethnarch
3 Comments
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 100 total points
ID: 18058653
try using ${ApplicationDIR} instead
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 25 total points
ID: 18060123
> ApplicationDIR

In order to be able to use it you will need ot define the "ApplicationDIR" parameter somewhere. Are you defining it?
0
 
LVL 2

Author Comment

by:ethnarch
ID: 18061940
i actually figured it out, ehh it was pretty simple all i had to do was put

<property name="hibernate.connection.url">jdbc:firebirdsql:embedded:USERDB.FDB</property>

I will try your idea later Ajay and i'll just give you both points for helping thanks anyway though.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now