From: | "Peter Futaro" <peterfutaro(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | DatabaseMetaData.getCatalogs() |
Date: | 2007-02-21 09:34:32 |
Message-ID: | ef32f7760702210134n18560449l9a6ef125ece83d33@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Dear all,
I have a remote machine, which is ushing Postgres v.7.4.11.
This machine has 2 database :
Database A & Database B
I have a task to list out the available database inside that machine in a
combo box. I have tried to using :
public String getDBList()
{
String s = "";
try
{
Class.forName(sDriver);
connection_this = DriverManager.getConnection(sURL, sUser,
sPassword);
dbMetaData_this = connection_this.getMetaData();
resultSet_this = dbMetaData_this.getCatalogs();
while(resultSet_this.next())
{
if(!resultSet_this.isFirst())
s += ",";
s += resultSet_this.getString(1);
}
return s;
}
catch(SQLException e)
{
return "error";
}
}
This will only return the database, that I state inside the URL
(e.g. String sURL = "jdbc:postgresql://<<ip>>:5432/databaseA" ---> will
return "databaseA" only).
I try to connect without stating any database inside the URL, also cannot.
Can you guys please help me ?
Thank you.
Peter Futaro
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2007-02-21 12:40:09 | Re: I have questions |
Previous Message | Hover Dong | 2007-02-21 03:29:10 | I have questions |