Scout/HowTo/5.0/Modify a derby database
Scout |
Wiki Home |
Website |
Download • Git |
Community |
Forums • Blog • Twitter • G+ |
Bugzilla |
Bugzilla |
The following how-to explains how you can add other columns to an existing table in your database. The database used in this example is the database from the MiniCrm Tutorial
Download and install Derby
Install a binary distribution such as db-derby-10.9.1.0-bin.zip. Switch to the bin subdirectory and start ij.bat. Connect to your database using the same connect string you used for the SQL service.
ij version 10.9 ij> connect 'jdbc:derby:c:/derbydb'; ij>
Operations on the database
Once connected here is how to examine the tables available:
ij> show schemas; TABLE_SCHEM ------------------------------ APP MINICRM ...
ij> show tables in minicrm; TABLE_SCHEM |TABLE_NAME |REMARKS ------------------------------------------------------------------------ MINICRM |COMPANY | MINICRM |COMPANY_FIGURES | MINICRM |CRM_SEQ | ... ij> describe minicrm.company; COLUMN_NAME |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL& ------------------------------------------------------------------------------ COMPANY_NR |DECIMAL |0 |10 |5 |NULL |NULL |NO SHORT_NAME |VARCHAR |NULL|NULL|60 |NULL |120 |NO ...
This is how you might have added the missing column:
ALTER TABLE minicrm.company ADD COLUMN my_new_column int;
Finally:
ij> disconnect; ij> exit;