pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Pilcher <i.pilcher@comcast.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: Problem w/ IDENT authentication
Date: Mon, 26 Jul 2004 10:46:53 -0500
Message-ID: <ce391e$3lm$1@sea.gmane.org> (raw)
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGIEHPNGAA.nickf@ontko.com>
References: <ce2gqj$8df$1@sea.gmane.org>
	<NEBBLAAHGLEEPCGOBHDGIEHPNGAA.nickf@ontko.com>

Nick Fankhauser wrote:
> 
> How are you testing the user?
> 
> If you haven't already done it, I'd try adding:
> 
> System.out.println( System.getProperty("user.name") ) ;
> 

I've added a call to System.getProperty("user.name") to the servlet.
Here is the complete source code:

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

public class HelloWorld extends HttpServlet
{
     public void doGet(HttpServletRequest request,
	    HttpServletResponse response)
     	    throws ServletException, IOException
     {

     	PrintWriter out = response.getWriter();
	out.println("Running as user '" +
		System.getProperty("user.name") + "'");

     	try
	{
	    Class.forName("org.postgresql.Driver");
	}
	catch (ClassNotFoundException cnfe)
	{
	    out.println("Error loading JDBC driver: " + cnfe);
	    return;
	}

	out.println("Successfully loaded JDBC driver");
	
	Connection db;
	
	try
	{
	    db = DriverManager.getConnection(
	    	    "jdbc:postgresql://127.0.0.1/tomcat4",
		    "tomcat4", "");
	}
	catch (SQLException sqle)
	{
	    out.println("Error connecting to database: " + sqle);
	    return;
	}
	
	out.println("Successfully connected to database");
	
	try
	{
	    db.close();
	}
	catch (SQLException sqle)
	{
	    out.println("Error closing database: " + sqle);
	    return;
	}
	
	out.println("Successfully closed database connection");
     }
}

And here is the output:

Running as user 'tomcat4'
Successfully loaded JDBC driver
Error connecting to database: org.postgresql.util.PSQLException: A 
connection error has occurred: org.postgresql.util.PSQLException: FATAL: 
IDENT authentication failed for user "tomcat4"

-- 
========================================================================
Ian Pilcher                                        i.pilcher@comcast.net
========================================================================




view thread (13+ messages)  latest in thread

Message-ID: <ce391e$3lm$1@sea.gmane.org>
Permalink:  ../ce391e$3lm$1@sea.gmane.org/
Also on:    postgresql.org/message-id/ce391e$3lm$1@sea.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: i.pilcher@comcast.net
  Subject: Re: Problem w/ IDENT authentication
  In-Reply-To: <ce391e$3lm$1@sea.gmane.org>
  References: <ce2gqj$8df$1@sea.gmane.org> <NEBBLAAHGLEEPCGOBHDGIEHPNGAA.nickf@ontko.com> <ce391e$3lm$1@sea.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox