Is it possible to create a jdbc connection without a password (using postgresql 'trust')?

Posted by mojones on Stack Overflow See other posts from Stack Overflow or by mojones
Published on 2010-05-14T09:11:32Z Indexed on 2010/05/14 9:14 UTC
Read the original article Hit count: 167

Filed under:
|
|

I am using jdbc to connect to a postgresql database in a java application (actually the app is written in Groovy). I have postgresql set up to use the 'trust' authentication method. Is it possible to open a jdbc connection without specifying a password? When I try to use the normal constructor with a blank password, it fails with

Exception in thread "Thread-2" org.postgresql.util.PSQLException: FATAL: password authentication failed for user "myuser"

Even though, from the command line, this works fine

psql -U myuser mydatabase
Welcome to psql 8.3.5, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
      \h for help with SQL commands
      \? for help with psql commands
      \g or terminate with semicolon to execute query
      \q to quit

© Stack Overflow or respective owner

Related posts about java

Related posts about jdbc