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

Can't get list of databases with \list

From: Christopher Frank <c(dot)frank(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Can't get list of databases with \list
Date: 2009-11-02 19:13:12
Message-ID: bedec1780911021113u1529b594p62f59d4f7a0a7e62@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
I recently installed PostgreSQL 8.2.11-1 on my Windows machine for use with
my java application. I need to get a list of the databases available so that
the user can choose one. Issuing a query of "\list" using jdbc doesn't seem
to work:

Connection connection =
DriverManager.getConnection("jdbc:postgresql:postgres", "user", "pass");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("\\list");

which produces:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "\"

Why is this and how can I fix it?

Responses

pgsql-novice by date

Next:From: JORGE MALDONADODate: 2009-11-02 19:16:37
Subject: GETTING INFO FROM SEQUENCE OBJECTS
Previous:From: Don FoxDate: 2009-11-02 18:16:52
Subject: Re: Install problems for postgresql-8.4.1

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