CONNECT 'jdbc:derby:c:\eclipse\scout\tutorial\org.eclipse.scout.tutorial.jaxws.database;create=true;';
CREATE SCHEMA TUTORIAL;

CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.connection.requireAuthentication', 'true');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.authentication.provider', 'BUILTIN');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.user.tutorial', 'scout');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.fullAccessUsers','tutorial');

CONNECT 'jdbc:derby:c:\eclipse\scout\tutorial\org.eclipse.scout.tutorial.jaxws.database' USER 'tutorial' PASSWORD 'scout';


CREATE TABLE TUTORIAL.COMPANY
  (COMPANY_NR     INT PRIMARY KEY NOT NULL,
   NAME           VARCHAR(50),
   SYMBOL         VARCHAR(5)
  );

CREATE TABLE TUTORIAL.WS_LOG
  (WS_LOG_NR     INT PRIMARY KEY NOT NULL,
   EVT_DATE      TIMESTAMP,
   SERVICE       VARCHAR(100),
   PORT          VARCHAR(100),
   OPERATION     VARCHAR(100),
   REQUEST       LONG VARCHAR,
   RESPONSE      LONG VARCHAR
  );

CREATE TABLE TUTORIAL.GLOBAL_SEQ
  (LAST_VAL     INT PRIMARY KEY NOT NULL
  );
INSERT INTO TUTORIAL.GLOBAL_SEQ (LAST_VAL) VALUES(100000);

INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(1, 'Exxon Mobil Corporation', 'XOM');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(2, 'IBM', 'IBM');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(3, 'Chevron Corporation', 'CVX');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(4, 'Johnson & Johnson', 'JNJ');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(5, 'UBS', 'UBS');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(6, 'Credit Suisse Group', 'CS');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(7, 'McDonalds Corporation', 'MCD');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(8, 'Amazon', 'AMZN');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(9, 'Google', 'GOOG');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(10, 'Hewlett-Packard', 'HPQ');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(11, 'Intel', 'INTC');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(12, 'Coca-Cola Company', 'KO');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(13, 'Microsoft', 'MSFT');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(14, 'Texas Instruments', 'TXN');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(15, 'Wal-Mart', 'WMT');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(16, 'Bank of America', 'BAC');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(17, 'Apple Inc.', 'AAPL');
INSERT INTO TUTORIAL.COMPANY (COMPANY_NR, NAME, SYMBOL) VALUES(18, 'Sony', 'SNE');

COMMIT;
