[PLUG] Abt JDBC

manoj gudi manojgudi at gmail.com
Wed Jan 10 18:17:31 IST 2007


Hi,

I am Manoj,TYBCS student from SP College.

Can some one help me out with this problem. I have been searching around for
some help but couldnt find any...

Im trying to connect PostgreSQL with Java..

//Prog Name:Connec.java

import java.sql.*;

public class Connec

{

public static void main(String args[])

{

ResultSet r;

try

{

Class.forName("org.postgresql.Driver");

String url="jdbc:postgresql:manoj";

String username="manoj";

String password="";

Connection c=DriverManager.getConnection(url,username,password);

}//try

catch(Exception e)

{

System.out.println("Error"+e);

}//catch

}//main

}//class



/*************************************************************************************

In this program

String url="jdbc:postgresql:manoj";

Here manoj is database name

String username="manoj";

Here manoj is username.

****************************************************************************************/

// After Compilation No Errors

[manoj at Manoj ~]$ javac Connec.java

// But error in Runtime

[manoj at Manoj ~]$ java Connec

Error A connection error has occurred: FATAL: Ident authentication failed
for user "manoj"



//My bash_profile file is

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/java/jdk1.5.0_07/bin:.

CLASSPATH=/usr/java/jdk1.5.0_07/lib/tools.jar:/usr/java/jdk1.5.0_07/jre/lib/rt.jar:/usr/java/pg73jdbc3.jar:.

export PATH CLASSPATH

unset USERNAME





/******************

I already created a postgres account

using

createuser manoj

createdb manoj

*************************************/

/*************************************

String url="jdbc:postgresql:postgres";

String username="postgres";

OR

String url="jdbc:postgresql:root";

String username="root";

Gives the same problem

Error A connection error has occurred: FATAL: Ident authentication failed
for user"postgres"

OR

Error A connection error has occurred: FATAL: Ident authentication failed
for user "root"

******************************************/

I have "Fedora 4".Please tell me what can i do to solve this problem.

Thanks

Manoj Gudi.



More information about the Plug-mail mailing list