I just installed the Orion server and was doing some preliminary testing
with servlets.  Simple I/O test work fine, however when I try to access an
informix database I get this error:
java.lang.ClassNotFoundException: com.informix.jdbc.IfxDriver

This is where I get really confused:
1) The servlet runs fine as an application, so I know the driver is in my
classpath
2) It works under Apache-JServ

CLASSPATH  =  /usr/local/JSDK2.0/lib/jsdk.jar:/usr/local/jdbc/ifxjdbc.jar:.

Thanks for the help.


/********************* BEGIN SERVLET CODE
************************************/
import javax.servlet.http.*;
import javax.servlet.ServletException;
import java.io.*;

public class conTest extends HttpServlet{

  protected void doGet(HttpServletRequest request, HttpServletResponse
response)
    throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        ifxCon ic = new ifxCon();
        String data = ic.getData();
    out.println("<html>");
    out.println("<body><CENTER><B>WORKING</B></CENTER>");
    out.println("<P><body><CENTER>" + data + "</CENTER>");
        out.println("</body></html>");
        out.close();

        }//end doGet

public static void main(String args[]){
conTest ct = new conTest();
ifxCon ic = new ifxCon ();
String alpha = ic.getData();
System.out.println("RESULT: " + alpha);
}
/************************ END SERVLET CODE **************************/

/********************* BEGIN CONNECTION CODE
************************************/
import java.sql.*;
import java.util.*;
import java.io.*;
import java.net.*;

public class ifxCon{
   Connection conn;
        String output = "Aarrghh Crap!";
        public String getData(){
        try{
                Class.forName("com.informix.jdbc.IfxDriver");
                        conn = DriverManager.getConnection
("jdbc:informix-sqli:xxx.xx.xxx.xx:xxxx/servlet_test:
INFORMIXSERVER=sid_servlet_test;user=user;password=password");
                System.out.println("CONNECTION WAS SUCCESSFULL: "  +
!conn.isClosed());
                        Statement stmt = conn.createStatement();
                        ResultSet rs = stmt.executeQuery("Select name from
value_list");
                        if(rs.next()){
                                output = rs.getString(1);
                        }//end if
                        stmt.close();
                        rs.close();
        }catch(Exception e){
                System.out.println("LOGIN_ERROR_CONNECTION_OBJECT: " + e);
                output = "ERROR: " + e;
        }//end try-catch
                        return output;
        }//end getConn

  public void closeConn(){
        try{
                conn.close();
        }catch(Exception e){
                System.out.println("ERROR_CLOSING_CONNECTION: " + e);
        }
  }//end closeConn

}

/************************ END CONNECTION CODE **************************/
                                      
 _________________    (Embedded image 
 Steve Gee            moved to file:  
 Certified Java       pic18034.gif)   
 Programmer                           
 Information                          
 Technologies                         
 Maxor National                       
 Pharmacies                           
                                      
 [EMAIL PROTECTED]                       
 806.324.5540                         
 www.maxor.com                        
 806.324.5400                         
                                      

Compuserve GIF

Reply via email to