Solved

Hibernate XML Configuration file and application path

Posted on 2006-12-01
3
341 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

911 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

19 Experts available now in Live!

Get 1:1 Help Now