cloudscape database in WAR file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   suresh_gurumurthy
Posted On:   Saturday, November 17, 2001 11:06 PM

hi all i have a WAR file wich has some servlets referring a cloudscape database with absolute path (d:myDB)and it works with this absolute path. I want to package the database along with the WAR file.I that case, what should be the URL in getConnection(). If i place the database outside the WAR, How it should be referred in the getConnection() URL in the servlets inside the WAR. I tried by placing the DB inside web-inf/DB, web-inf/classes/DB. but no effect. i want to know how the DB can be accessed by the servlets inside the WAR(by giving relative path). iam using Jboss-jetty server thanks in advance Suresh    More>>

hi all



i have a WAR file wich has some servlets referring a cloudscape database with absolute path (d:myDB)and it works with this absolute path. I want to package the database along with the WAR file.I that case, what should be the URL in getConnection().


If i place the database outside the WAR, How it should be referred in the getConnection() URL in the servlets inside the WAR.


I tried by placing the DB inside web-inf/DB, web-inf/classes/DB. but no effect.


i want to know how the DB can be accessed by the servlets inside the WAR(by giving relative path).
iam using Jboss-jetty server


thanks in advance
Suresh

   <<Less

Re: cloudscape database in WAR file

Posted By:   Marcel_Offermans  
Posted On:   Sunday, November 18, 2001 01:58 AM

The generic way of accessing files or "resources" from within a packaged Java application (JAR, WAR, EAR, ...) is by using ClassLoader.getSystemResource(String name) which will return a URL. Just put the resources somewhere in your classpath (in the root of your archive for example) and this will work. Note that this gives you read-only access, so if you want to actually write to your database, you need a different solution.

About | Sitemap | Contact