Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hibernate XML Configuration file and application path

Posted on 2006-12-01
3
Medium Priority
?
355 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 400 total points
ID: 18058653
try using ${ApplicationDIR} instead
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

885 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