Re: "\d tablename" to get column name, and column type by using JDBC

From: Paul Thomas <paul(at)tmsl(dot)demon(dot)co(dot)uk>
To: "pgsql-general (at) postgresql (dot) org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: "\d tablename" to get column name, and column type by using JDBC
Date: 2004-09-02 15:16:38
Message-ID: 20040902161638.A11793@bacon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 02/09/2004 15:52 Ying Lu wrote:
> Hello,
>
> Under mysql, we have "desc tablename" to get the detail information
> about a table. My question is about to get column name, and column type
> for a specific table under PostgreSQL through JDBC.
>
> Assume we have a table named "test". Under PSQL, we can input "\d test"
> to see the details about table "test" successufully. However, my main
> purpose is trying to get column name, column name of a table through
> JDBC.
>
> The following is the java code, by which I always get " ERROR: syntax
> error at or near "\" ".
>
> Some clues?

The \d command is a psql client feature. I has nothing to do with JDBC and
is not built into the server back-end (a few moments reading the source
code for psql would have shown you this). To obtain metadata through JDBC,
use the standard provided classes. If you don't know how to that then you
really need to learn JDBC. There's a good introductory tutorial on
java.sun.com

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+---------------------------------------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike 2004-09-02 15:28:46 Re: pgAccess via ssh?
Previous Message Doug McNaught 2004-09-02 15:16:31 Re: "\d tablename" to get column name, and column type by