This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q: Servlet in Tomcat 4.1connect database of CouldScape 10.0

 
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic