Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 51838 invoked from network); 6 Jan 2011 15:18:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Jan 2011 15:18:20 -0000 Received: (qmail 82297 invoked by uid 500); 6 Jan 2011 15:18:19 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 82104 invoked by uid 500); 6 Jan 2011 15:18:17 -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 82097 invoked by uid 99); 6 Jan 2011 15:18:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jan 2011 15:18:17 +0000 X-ASF-Spam-Status: No, hits=3.1 required=10.0 tests=HTML_MESSAGE,RCVD_NUMERIC_HELO,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Matt.Pouttu-Clarke@icrossing.com designates 38.101.13.26 as permitted sender) Received: from [38.101.13.26] (HELO scottsdale.email.icrossing.com) (38.101.13.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jan 2011 15:18:10 +0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 Received: from 38.101.13.2 ([38.101.13.2]) by santana.ic.aiall ([10.13.52.26]) via Exchange Front-End Server mail.icrossing.com ([10.13.52.24]) with Microsoft Exchange Server HTTP-DAV ; Thu, 6 Jan 2011 15:17:49 +0000 User-Agent: Microsoft-Entourage/12.28.0.101117 Date: Thu, 06 Jan 2011 08:17:46 -0700 Subject: Re: how to show all tables in current schema without using ij tool? From: Matt Pouttu-Clarke To: Derby Discussion CC: Sam Aoudi Message-ID: Thread-Topic: how to show all tables in current schema without using ij tool? thread-index: AcuttN8qhtIpixabj0SgoRqicUxCcg== In-Reply-To: <4D25B6E7.10809@frogthinker.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="B_3377146666_3893181" This is a multi-part message in MIME format. --B_3377146666_3893181 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Hi Emmanuel, For number 1: Connection conn =3D = DriverManager.getConnection("jdbc:derby:"); =20 ResultSet tables =3D conn.getMetaData().getTables(null, = null, null, null); while(tables.next()) { System.out.println(tables.getString("TABLE_NAME")); } tables.close(); For number 2: I don=B9t know because I never use cascading DB = constraints, as they don=B9t scale to any significant data sizes. However if you need cascading constraints with more scalability, try using a O/R mapping framework such as Hibernate... Cheers, Matt On 1/6/11 5:34 AM, "Emmanuel Cecchet" wrote: > Hi, > =20 >> I am struggling with issues when it comes to Apache derby: >> 1- I haven't been able to get a list of Tables in a schema without = using >> ij. Is this feasible? >> =20 > SELECT * FROM SYS.SYSTABLES >> 2- I haven't been able to use "On Delete Cascade", any good examples = are >> appreciated. >> =20 > CREATE TABLE a (pk INT NOT NULL CONSTRAINT a_pk PRIMARY KEY) > CREATE TABLE b (x LONG VARCHAR, id INT CONSTRAINT b_fk REFERENCES = a(pk) ON > DELETE CASCADE) > INSERT INTO a VALUES (1) > INSERT INTO b VALUES ('hello', 1) > SELECT * FROM a,b > =20 > PK X ID =20 > 1 hello 1 DELETE FROM b > SELECT * FROM a,b > =20 > PK X ID =20 > =20 > Hope this helps, > Emmanuel > =20 iCrossing Privileged and Confidential Information This email message is for the sole use of the intended recipient(s) and = may contain confidential and privileged information of iCrossing. Any = unauthorized review, use, disclosure or distribution is prohibited. If = you are not the intended recipient, please contact the sender by reply = email and destroy all copies of the original message. --B_3377146666_3893181 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Re: how to show all tables in current schema without using ij = tool? Hi Emmanuel,

For number 1:
=            Connect= ion conn =3D DriverManager.getConnection("jdbc:derby:<db name>"); =  
            R= esultSet tables =3D conn.getMetaData().getTables(null, null, = null, null);
            <= FONT COLOR=3D"#9F0A65">while
(tables.next()) {
            &= nbsp;   System.out.println(tables.getString("TABLE_NAME"));
            }=
            t= ables.close();

For number 2: I don’t know because I never use cascading DB = constraints, as they don’t scale to any significant data sizes. =  However if you need cascading constraints with more scalability, = try using a O/R mapping framework such as Hibernate...

Cheers,
Matt


On 1/6/11 5:34 AM, "Emmanuel Cecchet" <manu@frogthinker.org> wrote:

  Hi,
 
I am struggling with issues when = it comes to Apache derby:
 1-  I haven't been able to get a list of Tables in a schema = without using ij. Is this feasible?
 
SELECT * FROM SYS.SYSTABLES
2- I haven't been able to use = "On Delete Cascade", any good examples are appreciated.
  
CREATE TABLE a (pk INT NOT NULL = CONSTRAINT a_pk PRIMARY KEY)
 CREATE TABLE b (x LONG VARCHAR, id INT CONSTRAINT b_fk REFERENCES = a(pk) ON DELETE CASCADE)
 INSERT INTO a VALUES (1)
 INSERT INTO b VALUES ('hello', 1)
 SELECT * FROM a,b
   
 PK X ID  
 1 hello 1    DELETE FROM b
 SELECT * FROM a,b
   
 PK X ID    
 
 Hope this helps,
 Emmanuel
 

iCrossing Privileged and = Confidential Information
This email message is for the sole use = of the intended recipient(s) and may contain confidential and privileged = information of iCrossing. Any unauthorized review, use, disclosure or = distribution is prohibited. If you are not the intended recipient, = please contact the sender by reply email and destroy all copies of the = original message.

--B_3377146666_3893181--