Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B67987A30 for ; Thu, 28 Jul 2011 09:04:12 +0000 (UTC) Received: (qmail 23223 invoked by uid 500); 28 Jul 2011 09:04:12 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 22967 invoked by uid 500); 28 Jul 2011 09:04:02 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 22939 invoked by uid 99); 28 Jul 2011 09:04:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 09:04:00 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [148.87.113.117] (HELO rcsinet15.oracle.com) (148.87.113.117) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 09:03:51 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p6S93TFE018206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Jul 2011 09:03:30 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p6S93SHG024711 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 28 Jul 2011 09:03:28 GMT Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p6S93MYq023212 for ; Thu, 28 Jul 2011 04:03:22 -0500 Received: from localhost (/84.48.59.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 28 Jul 2011 02:03:22 -0700 From: Knut Anders Hatlen To: "Derby Discussion" Subject: Re: Getting the table structure programmatically References: <4E312242.4020707@spezifikum.com> Mail-Copies-To: never Mail-Followup-To: "Derby Discussion" Date: Thu, 28 Jul 2011 11:03:20 +0200 In-Reply-To: <4E312242.4020707@spezifikum.com> (Spezifikum's message of "Thu, 28 Jul 2011 10:48:02 +0200") Message-ID: User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (usg-unix-v) MIME-Version: 1.0 Content-Type: text/plain X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4E3125E3.0007:SCFMA922111,ss=1,re=-4.000,fgs=0 Spezifikum writes: > Hi > i have to read the structure of some tables i created and display that > in my HTML pages. So i tried to do something like > execute( "describe myTable" ) and get an SQL exception (invalid syntax). > Should i instead query some system tables? Hi Malte, The DESCRIBE syntax is only understood by the ij tool, and not available via SQL or JDBC. It is however implemented on top of DatabaseMetaData.getColumns(). Essentially, it just calls conn.getMetaData().getColumns(null, schema, table, null) and displays the following columns from the returned ResultSet: TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, TYPE_NAME, DECIMAL_DIGITS, NUM_PREC_RADIX, COLUMN_SIZE, COLUMN_DEF, CHAR_OCTET_LENGTH, IS_NULLABLE -- Knut Anders