Gaurav,

In my experience, I have discovered that the Apache WEB server requires
one to open up the CLASS_PATH to it as well.  In other words, when you
bring up (start) the WEB server, make sure you source a file that
specifically inits the CLASS_PATH environment variable, and make sure it
points to ALL the libraries you are using.

When I had this problem, it took me a couple of days to figure out that
the WEB server is need of these java libs.

I hope this helps!

Julio Monroy

Gaurav Kishore wrote:
>
> Hi,
>
> I read your code on servletsource.com by downloading the zip file
> which has a HC.java file, for connecting to the databse using jdbc. I
> am trying the same but haven't succeded. I have also posted this
> question to the servletfourm 'june'  '99 section.
>
> I am running Apache Web Server and Apache JServ on one machine (say
> M1) and the database (Oracle 7.2.3) is on another machine (say M2) . I
> have the jdbc thin driver installed on Machine M1 in the
> /usr/local/jdbc/lib/classes.zip. I have added this path to the
> jserv.properties file in wrapper.classpath.
>
> The following code compiles without error but while running it give
> ClassNotFoundException as well as error 'No Suitable Driver". What
> could be the reason for this :
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.sql.*;
> import java.math.*;
> import java.net.*;
> import java.lang.*;
>
> public class FourOOneK extends HttpServlet
> {
>     Connection con;
>     public void service(HttpServletRequest req, HttpServletResponse
> res) throws ServletException, IOException {
>
>
>         ServletOutputStream sout = res.getOutputStream();
>         res.setContentType("text/html");
>
>         try {
>             //DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
>             Class.forName("oracle.jdbc.driver.OracleDriver");
>         }
>
>         catch(ClassNotFoundException e)
>         {
>         sout.println( "<br>Error Oracle Driver Not Found: " + e + '\t'
> );
>         }
>
>         try {
>         con =
> DriverManager.getConnection("jdbc:oracle:thin:@xxxx:portno:yyyy",
> "usrname", "pwd");
>
>     / / What should be there in place of xxxx and yyyy??
>
>         //sout.println("<html>");
>         //sout.println("<head><title>My Table List </title></head>");
>         //sout.println("<body>");
>         //sout.println("I am here");
>
>         //DatabaseMetaData dmd = con.getMetaData();
>
>         // sout.println ( "<br>You are connected to : " +
> dmd.getDatabaseProductName() );
>         //sout.println ( "<br>The database version no. is : " +
> dmd.getDatabaseProductVersion() );
>         //sout.println ( "<br>You are currently logged in as : " +
> dmd.getUserName () );
>         //sout.println ( "</body></html>" ) ;
>         }
>
>         catch(SQLException e) {
>             sout.println ("<br>Error Connection : " + e.getMessage()
> );
>         }
>
>
>     }
> }
>
> Kindly help me to solve this apparently simple but persisting issue.
> Any help is highly appreciated.
>
> Thanks in advance
>
> Gaurav

--
Julio C. Monroy
Chief Information Officer
MallPhoria!
1400 Fashion Island Boulevard
San Mateo, California 94404
p: 650-349-0300
f: 650-571-1025
[EMAIL PROTECTED]

___________________________________________________________________________
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