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.