Skip site navigation (1) Skip section navigation (2)

Connection problems with jdbc

From: Andrew Brunette <brunette(dot)andrew(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Connection problems with jdbc
Date: 2010-04-27 23:38:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Hi, I'm new to postgres, and am having some issues getting started.  I am
trying to set up a java based dataload to postgres.  I've done the following

1) initialized postgres's db
2) created a database 'dev'
3) created a user, 'abrunette'.  I created the user as a superuser.
4) created a table, 'foo', using a standard create statement
5) created a password for the user.

I can log into postgres as abrunette.  I created the table as abrunette, and
can display it fine.

I then tried to configure my loader routine to access the database, using
the following code:

private void preparePostGreSQLDB() throws Exception {
        // Using simple URL for now, will need to be updated to work with
remote db server
        String sqlurl = "jdbc:postgresql:" + params.dbName;

        try {
            // Attempt to connect to a sql driver.
            conn = DriverManager.getConnection(sqlurl,
params.dbUser.toString(), params.dbPassword.toString());
        catch(SQLException dre) {
            throw new Exception ("Error in connecting to database using " +
        catch(Exception io) {
            throw new Exception ("Non SQL error in connecting to database
using " + sqlurl);

sqlurl ends up with the value "jdbc:postgresql:dev".  The username is
abrunette, and the password is correct as well.

When I run this, I get the message, "FATAL: Ident authentication failed for
user "abrunette"".  Testing seems to indicate that this message could come
from a variety of sources.  Can anyone suggest what I might be doing wrong?

I have experimented with different forms of the URL with no change to the
results.  Changing the database name doesn't change the result either, so I
suspect I've got something more fundamental wrong.

Any help will be greatly appreciated.  Thanks.



pgsql-jdbc by date

Next:From: Oliver JowettDate: 2010-04-28 00:04:00
Subject: Re: [Jdbc-commits] JDBC and real values returned by Postgres
Previous:From: Hervé HénochDate: 2010-04-26 13:48:22
Subject: Postgresql8.4 + floats with jdbc driver postgresql-8.4-701.jdbc4.jar

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group