You could use the ServletContext's getInputStream("fileName") method

Niall

----- Original Message ----- 
From: "Philippe PONSONNET" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 2004 12:35 AM
Subject: Access to a database with a configuration file


> Hello,
>
>
>
> I would like to use a database with struts without using the default
> datasource.
>
> I also would like to configure all acces of this database with a xml file
> named database.xml.
>
> The goal of this is to have a really independant model.
>
>
>
> So I have developped a special class named Database which uses the
> database.xml file for its connection.
>
> All my classes which map a table use this class. Like that, it is not
> nessecary to add some code in my action classes to connect the database.
>
>
>
> But I have a problem when I want to load the database.xml file : I can't
get
> its path when my webapp is loaded.
>
> The instruction getClass().getResource(".").getFile() always return null.
>
>
>
> How could I do ?
>
>
>
> Thanks in advance and sorry for my poor english.
>
>
>
> Philippe
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to