Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 75313 invoked from network); 21 Jan 2008 07:38:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jan 2008 07:38:25 -0000 Received: (qmail 98339 invoked by uid 500); 21 Jan 2008 07:38:14 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 98295 invoked by uid 500); 21 Jan 2008 07:38:14 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 98286 invoked by uid 99); 21 Jan 2008 07:38:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Jan 2008 23:38:14 -0800 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.6.24] (HELO gmp-eb-mail-2.sun.com) (192.18.6.24) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2008 07:37:47 +0000 Received: from fe-emea-10.sun.com (gmp-eb-lb-2-fe3.eu.sun.com [192.18.6.12]) by gmp-eb-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m0L7bpSR025613 for ; Mon, 21 Jan 2008 07:37:51 GMT Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JUZ00C01H5WX000@fe-emea-10.sun.com> (original mail from Jorgen.Loland@Sun.COM) for derby-dev@db.apache.org; Mon, 21 Jan 2008 07:37:51 +0000 (GMT) Received: from [129.159.112.194] by fe-emea-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JUZ007YVH72KA80@fe-emea-10.sun.com> for derby-dev@db.apache.org; Mon, 21 Jan 2008 07:37:50 +0000 (GMT) Date: Mon, 21 Jan 2008 08:37:50 +0100 From: =?ISO-8859-1?Q?J=F8rgen_L=F8land?= Subject: Re: Finding object type In-reply-to: <6b47fb310801190013u50ec923fxb64a2d9cab5bbe55@mail.gmail.com> Sender: Jorgen.Loland@Sun.COM To: derby-dev@db.apache.org Message-id: <47944BCE.7050903@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 8BIT References: <6b47fb310801190013u50ec923fxb64a2d9cab5bbe55@mail.gmail.com> User-Agent: Thunderbird 2.0.0.4 (X11/20070622) X-Virus-Checked: Checked by ClamAV on apache.org > Is there a function in the derby source code to find the type of an object.. > > i.e. if the XXX is a table , it should return 'TABLE' .. > if YYY is a view, it should return 'VIEW'.. > or anything like that?? > > please tell where to look for it.. > please help asap... Hi Jazarine, Would it be possible to use JDBC in your case? If so, you could e.g. have a look at DatabaseMetaData.getTables (check out the Java API). If that is not an option, you may write a query like the one below to get all non-system tables and views. select tablename, tabletype from sys.systables where tabletype not like 'S'; A tabletype of "T" is a normal table, while "V" means view. These methods should work if you want to find the table type from an application using Derby. If you want to find the tabletype *inside Derby* (because you modify the source code), I would start looking at org.apache.derby.client.am.DatabaseMetaData#getTables and find out what happens there. Hope this helps -- J�rgen L�land