db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Aoudi <aoud...@hotmail.com>
Subject RE: how to show all tables in current schema without using ij tool?
Date Thu, 06 Jan 2011 23:05:41 GMT

Thanks Matt and Emmanuel,

The Show table issue is resolved.

 However still working on delete issue.

Date: Thu, 6 Jan 2011 08:29:12 -0700
Subject: FW: how to show all tables in current schema without using ij tool?
From: Matt.Pouttu-Clarke@icrossing.com
To: aoudi_s@hotmail.com





Message body


Hi Sam,



This comment also addresses your questions I hope...



Cheers,

Matt



------ Forwarded Message

From: Matt Pouttu-Clarke <Matt.Pouttu-Clarke@icrossing.com>

Reply-To: Derby Discussion <derby-user@db.apache.org>

Date: Thu, 06 Jan 2011 08:17:46 -0700

To: Derby Discussion <derby-user@db.apache.org>

Cc: Sam Aoudi <aoudi_s@hotmail.com>

Subject: Re: how to show all tables in current schema without using ij tool?



Hi Emmanuel,



For number 1:

            Connection conn = DriverManager.getConnection("jdbc:derby:<db name>"); 


            ResultSet tables = conn.getMetaData().getTables(null, null, null, null);

            while(tables.next()) {

                System.out.println(tables.getString("TABLE_NAME"));

            }

            tables.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.






------ End of Forwarded Message




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. 		 	   		  
Mime
View raw message