Servlet fails to initalize on first call

Servlet fails to initalize on first call

Post by Ql8a » Sat, 15 Aug 1998 04:00:00



I've written several small servlets
('http://www.townpages.co.uk/ql8a/servlettest') but keep getting an
error the first time i call the servlet from a browser; however, when I
refresh the servlet, it works fine, and continues to work fine until the
servlet is stopped.

  Ql8a: sorry! The Database didn't load! System: java.sql.SQLException:
No suitable Driver

The section of code that initializes the database is as follows:

public void init(ServletConfig conf) throws ServletException {
  super.init(conf);

  try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:D8aTest");
    selectStatement = con.createStatement();
    deleteStatement = con.prepareStatement("delete from users where
Name=?");  // Ql8a: This works for 'chars' such as Name but not for
'ints'
  }  // end try
  catch (Exception e) {                // (ClassNotFoundException and
SQLException)
    throw(new UnavailableException(this, "Ql8a: Sorry! The Database
didn't load! System: " + e));  // Throw an UnvailableException
  }

Quote:}   // end public void init(ServletConfig conf)

Does anyone know why this is happening?

much thanks

don

 
 
 

1. Calling a Servlet from another Servlet

Hello,

I am trying to call a method of a servlet that is not called directly.
When I try to obtain a reference to thar servlet, I get an exception
whose message is the name of the intended servlet.

PrincipalServlet ps = (PrincipalServlet)
getServletConfig().getServletContext().getServlet("PrincipalServlet");

ps.method(...);

Exception: PrincipalServlet

What is the problem?

2. INSERT statement where you don't know table structure

3. MDX ADODB call fails first time

4. Announcing Fujitsu COBOL version 3.0 for Windows 95 and NT

5. Odbctrac.dll failed to initalize during install of SQL

6. Btrieve Locked Problem

7. Access Forums

8. What must i do first to learn Java Servlet

9. DTS Package call another, when child fails, parent fails

10. Cursor fails when called procedure called from trigger

11. Merge Agent Fails - sp_MSupdategenhistory call fails

12. Calling XSQL from a java servlet, and passing in the xml-stylesheet