Where to put the Database? in a servlet & Tomcat


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Where to put the Database? in a servlet & Tomcat

  1. #1
    Join Date
    Oct 2004
    Posts
    11

    Where to put the Database? in a servlet & Tomcat

    i'm using Tomcat to run servlets i have a class that deals with generating the HTML, and another that connects to the database and returns a resultSet.

    the code to connect to the database is as follows,
    Code:
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           String sourceURL = new String
           ("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=IPO.mdb;");
           Connection databaseConnection =
                   DriverManager.getConnection(sourceURL, "admin", "");
    i've used this code on another app, the only thing thats been changed is the database name.

    when running the servlet i get an SQL error about the database not being found, the database is in the project directory that JBuilder created, this worked for the aforementioned application.

    so where would i have to put the database in the tomcat servers directory, for my servletts to be able to read from it?

  2. #2
    Join Date
    Oct 2004
    Posts
    311
    from what I can tell, you are using the jdbc/odbc bridge driver. This means that all you really need is an odbc connection to your database. After this, the location shouldn't really matter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center