Solved

Hibernate XML Configuration file and application path

Posted on 2006-12-01
3
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.
Suggested Courses

635 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