From: | inderpreet vohra <parul195(at)yahoo(dot)co(dot)in> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | ident authentication in fedora core 6 |
Date: | 2007-04-16 06:30:55 |
Message-ID: | 855963.81179.qm@web8609.mail.in.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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/
From | Date | Subject | |
---|---|---|---|
Next Message | villeja | 2007-04-16 14:15:41 | Bug in timezone-parsing? |
Previous Message | Frank Spies | 2007-04-14 22:45:43 | junit test results |