tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From damar thapa <da...@netvigator.com>
Subject jdbc problem - tomcat4.0.4/mod_jk/postgresql7.0.
Date Sat, 14 Sep 2002 11:28:23 GMT
Hi,

I have the following code, which I can compile, but when I run, I get 
SQLException (full exception output following this code):

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class AddDispServlet extends HttpServlet{

   public void doGet(HttpServletRequest req, HttpServletResponse res) 
throws ServletException, IOException{
       Connection con = null;
       Statement stmt = null;
       ResultSet rs = null;
      
       res.setContentType("text/html");
       PrintWriter out = res.getWriter();
      
       try{
           Class.forName("org.postgresql.Driver");
           con =  
DriverManager.getConnection("jdbc:postgresql:contacts","damar","");
           stmt = con.createStatement();
           rs = stmt.executeQuery("select ser, name, email, hompage, 
telephone, postaladdress  from address");
          
           out.println("<HTML><HEAD><TITLE>My contacts</title></head>");
           out.println("<body>");
           out.println("<url>");
           while(rs.next()){
               out.println("<li>" + rs.getInt("ser")+" 
"+rs.getString("name")+" "+rs.getString("email")+
               " "+rs.getString("hompage")+" " 
+rs.getString("telephone")+" " +rs.getString("postaladdress"));
           }
           out.println("</ul>");
           out.println("</body></html>");
       }
       catch(ClassNotFoundException e){
           out.println("Couldnot load database driver : " + e.getMessage());
       }
       catch(SQLException e){
           out.println("SQLException caught: " + e.getMessage());
       }
       finally{
           try{
               if(con!=null)
                   con.close();
           }
           catch(SQLException ignored){}
       }
   }
}
  




SQLException caught: Something unusual has occured to cause the driver 
to fail. Please report this exception: Exception: java.sql.SQLException: 
FATAL 1: IDENT authentication failed for user "damar" Stack Trace: 
java.sql.SQLException: FATAL 1: IDENT authentication failed for user 
"damar" at org.postgresql.Connection.openConnection(Connection.java:178) 
at org.postgresql.Driver.connect(Driver.java:149) at 
java.sql.DriverManager.getConnection(DriverManager.java:512) at 
java.sql.DriverManager.getConnection(DriverManager.java:171) at 
AddDispServlet.doGet(AddDispServlet.java:18) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) 
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) 
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) 
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) 
at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) 
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) 
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) 
at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) 
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) 
at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) 
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) 
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) 
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) 
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) 
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) 
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) 
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) 
at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027) 
at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125) 
at java.lang.Thread.run(Thread.java:536) End of Stack Trace

Remaining note:  
 
My OS is Debian3. (Woody).

The given sql statement is correct ie it can produce result in normal 
circumstances.  I have placed pgjdbc2.jar in 
/wepapps/Project/WEB-INF/lib, and compiled the above code normally with 
javac,  and placed in in ../WEB-INF/classes.
What I have missed? Any pointers would be highly appreciated.

Thanks

Damar


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message