pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Brunette <brunette.andrew@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Connection problems with jdbc
Date: Tue, 27 Apr 2010 16:38:18 -0700
Message-ID: <h2s326b1ea31004271638k8fa38c3cp9a8db7af4f28c69f@mail.gmail.com> (raw)

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
things:

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.
            Class.forName("org.postgresql.Driver");
            conn = DriverManager.getConnection(sqlurl,
params.dbUser.toString(), params.dbPassword.toString());
            conn.setAutoCommit(true);
        }
        catch(SQLException dre) {
            logger.info(dre.getMessage());
            throw new Exception ("Error in connecting to database using " +
sqlurl);
        }
        catch(Exception io) {
            logger.info(io.getMessage());
            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.

Andrew

view thread (2+ messages)  latest in thread

Message-ID: <h2s326b1ea31004271638k8fa38c3cp9a8db7af4f28c69f@mail.gmail.com>
Permalink:  ../h2s326b1ea31004271638k8fa38c3cp9a8db7af4f28c69f@mail.gmail.com/
Also on:    postgresql.org/message-id/h2s326b1ea31004271638k8fa38c3cp9a8db7af4f28c69f@mail.gmail.com

 · 

reply

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: brunette.andrew@gmail.com
  Subject: Re: Connection problems with jdbc
  In-Reply-To: <h2s326b1ea31004271638k8fa38c3cp9a8db7af4f28c69f@mail.gmail.com>
  References: <h2s326b1ea31004271638k8fa38c3cp9a8db7af4f28c69f@mail.gmail.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