Home | Previous Page | Next Page   Basics of Database Design and Implementation > Implementing a Relational Data Model > Creating the Database >

Using Command Scripts

You can enter SQL statements interactively to create the database and tables. In some cases, you might have to create the database and tables two or more times. For example, you might have to create the database again to make a production version after a test version is satisfactory, or you might have to implement the same data model on several computers. To save time and reduce the chance of errors, you can put all the statements to create a database in a file and later re-execute those statements.

Capturing the Schema

The dbschema utility is a program that examines the contents of a database and generates all the SQL statements you require to re-create it. You can build the first version of your database, making changes until it is exactly as you want it. Then you can use dbschema to generate the SQL statements necessary to duplicate it. For information about the dbschema utility, see the IBM Informix: Migration Guide.

Executing the File

Programs that you use to enter SQL statements interactively, such as DB-Access, can be run from a file of commands. You can start DB-Access to read and execute a file of commands that you or dbschema prepared. For more information, see the IBM Informix: DB-Access User's Guide.

An Example

Most IBM Informix database server products come with a demonstration database (the database that most of the examples in this book use). The demonstration database is delivered as an operating-system command script that calls IBM Informix products to build the database. You can copy this command script and use it as the basis to automate your own data model.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]