----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi Chris,
Sorry if the question is dumb( I am new to servlets & JServ). Is'nt the CLASSPATH used 
by JServ same as the CLASSPATH for the system. If so then it should not be a problem 
as the first piece of code is able to load the driver successfully. 
Again as I said - if there is something very obvious about it then please let me know 
as I have just started to get a hang of servlets!
Thanks
Anshu.

--- "Chris Roberts" <[EMAIL PROTECTED]>
> wrote:
>----------------------------------------------------------------
>BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
>WHEN YOU POST, include all relevant version numbers, log files,
>and configuration files.  Don't make us guess your problem!!!
>----------------------------------------------------------------
>
>Any error message?
>
>My guess...CLASSPATH prob.(I know...that's my answer to everything)
>
>Are you sure the CLASSPATH that jserv is using, includes your driver class?
>
>>Hi,
>>
>>I am using RH Linux 6.2 with following:
>>Apache/1.3.12 (Unix)
>>  ApacheJServ/1.1.1
>>  postgresql 6.5.3-6
>>
>>My problem is that the code given in heading A works but when I try to use 
>>it in a servlet ( heading B) it fails to make connection to database.
>>
>>"Case A -works "
>>import java.sql.*;
>>public class data{
>>   public data(){
>>    String url="jdbc:postgresql://localhost:5432/pan01";
>>    try{
>>     Class.forName("postgresql.Driver");
>>     Connection c= DriverManager.getConnection(url,"yyyyyy","xxxxxxx");
>>    }catch (Exception e)
>>       {System.out.println(e.getMessage());}
>>    }
>>
>>  public static void main(String args[]){
>>     data dat=new data();
>>  }
>>}
>>
>>"Case B -does not work"
>>import java.io.*;
>>import javax.servlet.*;
>>import javax.servlet.http.*;
>>import java.sql.*;
>>public class sample extends HttpServlet{
>>   public void doGet(HttpServletRequest req,HttpServletResponse      
>>res)throws ServletException, IOException{
>>   try {
>>            res.setContentType("text/html");
>>            PrintWriter out = res.getWriter();
>>            Class.forName("postgresql.Driver");
>>            String url = "jdbc:postgresql://localhost:5432/pan01";          
>>         Connection con=                                                    
>>  DriverManager.getConnection(url,"yyyyyy","xxxxxxx");
>>          }catch (Exception e){
>>                  res.setContentType("text/html");
>>                  PrintWriter out = res.getWriter();                        
>>              out.println("This is not working ");
>>         }
>>    }
>>}
>>
>>If you have any idea why is it happening please let me know.
>>Thanks!
>>Anshu
>>
>>_____________________________________________________________
>>TheFreeSite.com: Home of the Web's best freebies.
>>http://www.thefreesite.com
>>
>>
>>--
>>--------------------------------------------------------------
>>Please read the FAQ! <http://java.apache.org/faq/>
>>To subscribe:        [EMAIL PROTECTED]
>>To unsubscribe:      [EMAIL PROTECTED]
>>Search Archives:
>><http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
>>Problems?:           [EMAIL PROTECTED]
>>
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>Share information about yourself, create your own public profile at 
>http://profiles.msn.com.
>
>
>
>--
>--------------------------------------------------------------
>Please read the FAQ! <http://java.apache.org/faq/>
>To subscribe:        [EMAIL PROTECTED]
>To unsubscribe:      [EMAIL PROTECTED]
>Search Archives: 
><http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
>Problems?:           [EMAIL PROTECTED]

_____________________________________________________________
TheFreeSite.com: Home of the Web's best freebies.
http://www.thefreesite.com


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to