pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Fatal: Database does not exist
2+ messages / 2 participants
[nested] [flat]

* Fatal: Database does not exist
@ 2009-02-27 21:41  Suvanaket, Dear (MS) <Dear.Suvanaket@ngc.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Suvanaket, Dear (MS) @ 2009-02-27 21:41 UTC (permalink / raw)
  To: pgsql-admin

 
Hi,
 
I get the error "FATAL: Database "xxx" does not exist" when trying to connect to the database using JDBC. The superuser "postgres" owns my database and tables. However, it seems I can only connect to the database when the username matches the name of the database I am connecting to. I can't connect to the database as the superuser postgres who owns the database. For example, if my database were named "Trudy", I can only connect with a user named "Trudy".
 
The Java code I'm using to connect looks something like this:
 
  try{
         //Register the JDBC driver for PostgreSQL.
         Class.forName(driverType);
               
         //Get a connection to the database
         Connection conn = DriverManager.getConnection(url, username, password);
         PreparedStatement ps = 
             conn.prepareStatement(jsassql);
           ps.execute();
           conn.close();
      }
      catch(Exception e){
         e.printStackTrace();
      } 
 
Is there anyway to fix the access so I can use a superuser other than the one named after the database?
 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Fatal: Database does not exist
@ 2009-02-27 22:42  Scott Marlowe <scott.marlowe@gmail.com>
  parent: Suvanaket, Dear (MS) <Dear.Suvanaket@ngc.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Scott Marlowe @ 2009-02-27 22:42 UTC (permalink / raw)
  To: Suvanaket, Dear (MS) <Dear.Suvanaket@ngc.com>; +Cc: pgsql-admin

On Fri, Feb 27, 2009 at 2:41 PM, Suvanaket, Dear (MS)
<Dear.Suvanaket@ngc.com> wrote:
>
> Hi,
>
> I get the error "FATAL: Database "xxx" does not exist" when trying to
> connect to the database using JDBC. The superuser "postgres" owns my
> database and tables. However, it seems I can only connect to the database
> when the username matches the name of the database I am connecting to. I

What does your pg_hba.conf file say?



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2009-02-27 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-02-27 21:41 Fatal: Database does not exist Suvanaket, Dear (MS) <Dear.Suvanaket@ngc.com>
2009-02-27 22:42 ` Scott Marlowe <scott.marlowe@gmail.com>

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