If it works fine in your regular application, the only thing I can think of
is whether you had your jdbc driver included in your web server CLASSPATH
environment.  Web servers in general do not use your system CLASSPATH.

Mike


>From: sven <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: DB2 jdbc driver & servlet.
>Date: Fri, 28 Apr 2000 13:12:28 -0300
>
>I've just installed DB2 v7.1 and am trying to create a simple servlet to
>test the driver. I have some code that works perfectly well as an
>application, but a soon as I try the same in a servlet, it does not
>work.
>     public void doGet (HttpServletRequest request, HttpServletResponse
>response) throws ServletException, IOException{
>         PrintStream out = new PrintStream (response.getOutputStream());
>         Connection conn = null;
>         Statement stmt = null;
>         response.setContentType ("text/html");
>       try {
>          // register the driver with DriverManager
>          // The newInstance() call is needed for the sample to work with
>          // JDK 1.1.1 on OS/2, where the Class.forName() method does not
>          // run the static initializer. For other JDKs, the newInstance
>          // call can be omitted.
>
>Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");//.newInstance();
>       } catch (Exception e) {
>          e.printStackTrace(out);
>       }
>
>       try {
>           // Get a DB connection from the Broker
>           //for (int i = 0 ; i <= 10000; i++);
>           String url = "jdbc:db2:sample";
>           String user = "like";
>           String pwd = "duh!";
>           conn = DriverManager.getConnection(url, user, pwd);
>
>The error give is:
>Error code: java.sql.SQLException: No suitable driver
>
>Can anyone tell me what I'm doing wrong here ??
>
>sven
>--
>-------------------------------------------------------------------------------------------
>Sven E. van 't Veer                                                Afiliado
>Universo Online
>Gerente Desenvolvimento
>Brasil Inform�tica e Telecomunica��es Ltda.
>http://www.brvip.com.br
>http://www.uol.com.br
>-------------------------------------------------------------------------------------------
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to