DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links