• Post Reply Bookmark Topic Watch Topic
  • New Topic

Q: Servlet in Tomcat 4.1connect database of CouldScape 10.0  RSS feed

 
Sam Sun
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!