Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 601687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:44:33+00:00 2026-05-13T16:44:33+00:00

Is it possible to use a relative path to an SQLite database file in

  • 0

Is it possible to use a relative path to an SQLite database file in the context.xml file of a Java web application?

At present, I have:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/mywebapp">
    <Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000"
        username="myusername" password="mypassword" driverClassName="org.sqlite.JDBC"
        url="jdbc:sqlite://Users/me/NetBeansProjects/MyApp/web/my.db"/>
</Context>

As you can see, the url attribute of the Resource tag currently specifies an absolute path to my.db. However, I am working on this project with a small team of developers as a class project. We are sharing the code through Subversion and currently, every time one of us updates our project, we have to manually replace the above path with the correct path for our computer.

Thanks in advance.


UPDATE: It appears that relative paths are not relative to the context.xml file, but to CATALINA_HOME. Unfortunately that directory (where Tomcat is located) is in another user’s home folder (1) to which I have ony read access:

(1) /home/myprof/Tomcat/bin/
(2) /home/me/NetBeansProjects/MyApp/web/my.db

I cannot include /me in the relative path because, as stated above, this project will run on multiple computers via a svn repository and the directory in which the project files are contained (2) will change. However, since all of the accounts are on a shared virtual network, CATALINA_HOME (1) will not change.


Also, how can I get the path to the database file my.db from the context.xml file above inside a servlet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:44:33+00:00Added an answer on May 13, 2026 at 4:44 pm

    I found the answer to my question here. The solution is to get the resource rather than try to parse the database URL out of the context.xml file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within a robots.txt file, would be possible to use a relative path instead of
I have an absolute path to file A. I have a relative path to
I have an ASP.NET MVC web application running in IIS as a subweb; let's
I'm interested in Qooxdoo as a possible web development framework. I have downloaded the
Is it possible to add a relative directory (ie, foo/bar/plugh) to the java classpath
Is it possible to pass a relative path to create my child process? This
In CSS, any image path is relative to the CSS file location. f.ex if
I want to use the compileroptions tag in the web.config to version my DLL
Is it possible to use variables to set relative paths in Sass? I've tried
Is it possible use mod_rewrite to resolve addresses hosted on another server? Say I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.