Hi.. thanks for the quick response... that is exactly what I am trying, and I am getting SQL Exceptions on the ; in the statement... I will have another look and make sure its not something else going wrong..

Thanks again

--------------------------------------------------
From: "bruehlicke" <[email protected]>
Sent: Thursday, October 08, 2009 4:23 PM
To: "Derby Discussion" <[email protected]>
Subject: Re: Create DB Structure in one statement

          Statement s = _connection.createStatement();

           s.execute(
                   "CREATE TABLE TABLE1 (" +
                   "ID BIGINT NOT NULL PRIMARY KEY GENERATED ALWAYS
AS IDENTITY (START WITH 1, INCREMENT BY 1)," +
                   "NAME VARCHAR(80) NOT NULL," +
                   "VALUE VARCHAR(12) NOT NULL," +
                   "DESCRIPTION VARCHAR(255)," +
                   "CREATED_BY VARCHAR(40) DEFAULT USER," +
                   "CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP," +
                   "LAST_UPDATED TIMESTAMP DEFAULT CURRENT_TIMESTAMP" +
                   ")" + ";" +
                   "CREATE TABLE TABLE2 (" +
                   "ID BIGINT NOT NULL PRIMARY KEY GENERATED ALWAYS
AS IDENTITY (START WITH 1, INCREMENT BY 1)," +
                   "NAME VARCHAR(80) NOT NULL," +
                   "VALUE VARCHAR(12) NOT NULL," +
                   "DESCRIPTION VARCHAR(255)," +
                   "CREATED_BY VARCHAR(40) DEFAULT USER," +
                   "CREATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP," +
                   "LAST_UPDATED TIMESTAMP DEFAULT CURRENT_TIMESTAMP" +
                   ")"
            );


Should work - this would create 2 table in one statement.

B-)


On Thu, Oct 8, 2009 at 2:38 PM, Rick Schneider
<[email protected]> wrote:
OK.. I am trying to create my entire DB structure (about 6 tables or so) in a single JDBC Statement to embedded Derby 10.5. I keep running into issues with the proper syntax to separate the different statements. Is there a way
to do this other than running multiple statements?

Thanks

Reply via email to