From: inderpreet vohra <parul195@yahoo.co.in>
To: pgsql-jdbc@postgresql.org
Subject: ident authentication in fedora core 6
Date: Mon, 16 Apr 2007 07:30:55 +0100 (BST)
Message-ID: <855963.81179.qm@web8609.mail.in.yahoo.com> (raw)
im facing problems with the following code..
initially the jdbc driver was not getting
registered...that problem is rectified...now im facing
problems connecting with the database..
******************************************************import
java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
public class Example1 {
public static void main(String[] argv) {
System.out.println("Checking if Driver is registered
with DriverManager.");
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("Couldn't find the driver!");
System.out.println("Let's print a stack trace, and
exit.");
cnfe.printStackTrace();
System.exit(1);
}
System.out.println("Registered the driver ok, so
let's make a connection.");
Connection c = null;
try {
// The second and third arguments are the username
and password,
// respectively. They should be whatever is
necessary to connect
// to the database.
c =
DriverManager.getConnection("jdbc:postgresql://localhost/ids","postgres","123456");
} catch (SQLException se) {
System.out.println("Couldn't connect: print out a
stack trace and exit.");
se.printStackTrace();
System.exit(1);
}
if (c != null)
System.out.println("Hooray! We connected to the
database!");
else
System.out.println("We should never get here.");
}
}
*****************************************************
*****************************************************
The error that im geting is
*****************************************************
Checking if Driver is registered with DriverManager.
Registered the driver ok, so let's make a connection.
Couldn't connect: print out a stack trace and exit.
org.postgresql.util.PSQLException: A connection error
has occurred: org.postgresql.util.PSQLException:
FATAL: Ident authentication failed for user "postgres"
at
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnectionV3(AbstractJdbc1Connection.java:337)
at
org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:214)
at org.postgresql.Driver.connect(Driver.java:139)
at
java.sql.DriverManager.getConnection(libgcj.so.7rh)
at
java.sql.DriverManager.getConnection(libgcj.so.7rh)
at Example1.main(Example1.java:27)
******************************************************
kindly help me with this.... my final yr project
is stuck up because of this...
...Parul
Send a FREE SMS to your friend's mobile from Yahoo! Messenger. Get it now at http://in.messenger.yahoo.com/
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: parul195@yahoo.co.in
Subject: Re: ident authentication in fedora core 6
In-Reply-To: <855963.81179.qm@web8609.mail.in.yahoo.com>
References: <855963.81179.qm@web8609.mail.in.yahoo.com>
* 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