• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Q: Servlet in Tomcat 4.1connect database of CouldScape 10.0

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's ok when I connect to database in the general application. Just put the database in the same folder as the class. However, it doesn't work with servlet. I try lots of way to locate the database but still can't connect to it.

Below is my program. I appreciate it if you give me a hint.
I use Cloudscape version 10.0 installed in C:\Cloudscape, Tomcat 4.1.

private Connection conn;
private Statement s;

public void init(ServletConfig config) {

Class.forName(config.getInitParameter("databaseDriver")).newInstance();
conn = DriverManager.getConnection(config.getInitParameter("databaseName"));

}

databaseDriver is org.apache.derby.jdbc.EmbeddedDriver
databaseName is jdbc erby:faqs

I don't think it's very clear. Please let me know if you need additional information.

Thank.
 
reply
    Bookmark Topic Watch Topic
  • New Topic