title: Relative path to SQLite DB in context.xml
body: <p>Is it possible to use a relative path to an SQLite database file in the context.xml file of a Java web application?</p>
  
  <p>At present, I have:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context path="/mywebapp"&gt;
      &lt;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"/&gt;
  &lt;/Context&gt;</code></pre>
  
  <p>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.</p>
  
  <p>Thanks in advance.</p>
  
  <hr />
  
  <p><strong>UPDATE:</strong> 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:</p>
  
  <p>(1) /home/myprof/Tomcat/bin/<br />
  (2) /home/me/NetBeansProjects/MyApp/web/my.db</p>
  
  <p>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.</p>
  
  <hr />
  
  <p>Also, how can I get the path to the database file my.db from the context.xml file above inside a servlet?</p>