Creating and Updating an SQLite or a DBMS Database
You must use the sqlite
mode to create or update an SQLite
database and the dbms
mode to create or update a DBMS database.
The input files required to create a database file in SQLite and DBMS
modes are an SDB configuration file and an SQL file. The SQL file contains
database schema definition and data in the form of standard SQL statements. The
SDB configuration file contains the security settings and database
configuration settings. For more information on creating input files, see
Creating and Modifying Input Files for an SQlite or a DBMS Database.
Creating an SQLite or a DBMS database
You can use the following command to create an SQLite or DBMS database:
> SDB -m <sqlite or dbms> -c <configuration XML
file> [input SQL files]
Where -m
can be sqlite
or dbms
.
For information about the various options in the preceding command, see
SDB Creator Tool Syntax.
The following are some example scenarios:
-
To create an SQLite database file:
> sdb -m sqlite -c config_sqlite.xml input_schema.sql
input_data.sql
This command creates the sdb.db
SQLite database in the
default location by using the settings in config_sqlite.xml
, the
schema in input_schema.sql
and the data in
input_data.sql
.
-
To create a DBMS database file by specifying the required output
database file name and location:
> sdb -m dbms -i input.db -c config_dbms.xml -o ouput.db
input_schema_data.sql
This command creates the output.db
database as a copy
of the input.db
database. It then updates output.db
with the settings in config_dbms.xml
and with the SQL data from
input_schema_data.sql
.
Note: The SQL data and schema information can be mentioned
in the same file or in a different file.
Updating an SQlite or a DBMS database
You can use the following command to update an existing database file:
> SDB -m <sqlite or dbms> -i <input database
file> -c <configuration XML file> -o <output database file>
[input SQL files]
Note: To update an existing input SQLite or DBMS database,
you must specify same file name for the input (using -i
tag) and
output (using -o
tag) databases. For information about the various
options in the preceding command, see SDB Creator Tool Syntax.
The following are some example scenarios:
-
To update an existing SQLite database file:
> SDB -m sqlite -i input_sqlite.db new_sqldata.SQL -o
input_sqlite.db
This command updates input_sqlite.db
with the SQL data
in the new_sqldata.SQL
file.
-
To update an existing DBMS database file:
> SDB -m dbms -i input_dbms.db -c new_settings.xml -o
input_dbms.db
This command updates input_dbms.db
with the settings
in the new_settings.xml
file.
Note: You must use the -c
option only if you
are providing the configuration settings in an XML configuration file.