Re: Problem w/ IDENT authentication
От | Ian Pilcher |
---|---|
Тема | Re: Problem w/ IDENT authentication |
Дата | |
Msg-id | ce391e$3lm$1@sea.gmane.org обсуждение исходный текст |
Ответ на | Re: Problem w/ IDENT authentication ("Nick Fankhauser" <nickf@ontko.com>) |
Список | pgsql-jdbc |
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 ========================================================================
В списке pgsql-jdbc по дате отправления: