Dc Redwing
Dc Redwing

Reputation: 1791

psql org.postgresql.util.PSQLException: FATAL

I just start to install and run eclipse to access to psql server. And running windows 7 32 bits

I just set up the basic form for web app form in the eclipse.

in the content.xml file i have..

<Context path="" debug="5" override="true" reloadable="true">
<Resource   name="jdbc/connection_pool"
            description="DB Connection Pool"
            driverClassName="org.postgresql.Driver"
            type="javax.sql.DataSource"
            auth="Container"
            url="jdbc:postgresql://localhost/students-database" 
            username="postgres"
            password="1234"
            defaultAutoCommit="false"
            maxActive="10"
            minIdle="0"
            maxIdle="5"
            maxWait="3000"
            removeAbandoned="true"
            removeAbandonedTimeout="60"
            logAbandoned="true"
            validationQuery="SELECT 1" />

and

in the DbConnectionPool.jave i have..

public class DbConnectionPool {

// Registering Postgresql JDBC driver with the DriverManager
static {
    try {
        Class.forName("org.postgresql.Driver");
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}

/**
 * Returns a <code>java.sql.Connection</code> object.
 * 
 * @exception NamingException
 *                if the JDBC resource is not found
 * @exception SQLException
 *                if a connection can not be obtained
 * 
 * @return Connection to use
 */
public static Connection getConnection() throws NamingException,
        SQLException {

    // TODO: To be replaced with real connection pool after we have covered it in class

    return DriverManager.getConnection(
            "jdbc:postgresql://localhost/students-database?" +
            "user=postgres&password=1234");
}

}

I didn't insert the any data in the psql program,

i just make simple jsp file and when I am compiling to run jsp file

i am getting error

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"

I am not really sure why.

when i connect the psql program i can see the 4 psql and i am currently try to use 8.4 for building web-app

enter image description here

I just wondering why this happen. I just followed direction and I googled cause of errors.

but doesn't work.

does anyone know how to fix it ?

Upvotes: 0

Views: 3776

Answers (1)

austin
austin

Reputation: 5866

I'm going to guess you have a password on the database and you need to provide it with the rest of the parameters. Also, make sure the file is context.xml not content.xml.

Upvotes: 1

Related Questions