3.4. Loading the Database Definition

Documentation

VoltDB Home » Documentation » Administrator's Guide

3.4. Loading the Database Definition

Responsibility for loading the database schema and stored procedures varies from company to company. In some cases, operators and administrators are only responsible for initiating the database; developers may load and modify the schema themselves. In other cases, the administrators are responsible for both starting the cluster and loading the correct database schema as well.

If you are responsible for establishing the correct schema, the next step is to load the Java stored procedures and the schema definition. Stored procedures are compiled into classes and then packaged into a JAR file, as described in the section on installing stored procedures in the Using VoltDB manual. To fully load the database definition you will need the JAR of stored procedure classes and a text file containing the data definition language (DDL) statements that declare the database schema.

The following example assumes these two files are storedprocs.jar and dbschema.sql. Once the database cluster has started, you can load the schema and stored procedures using the sqlcmd utility. To load them at the sqlcmd prompt, you can use the sqlcmd load classes and file directives:

$ sqlcmd
1> load classes storedprocs.jar;
2> file dbschema.sql;

Note that when loading the schema, you should always load the stored procedures first, so the class files are available for any CREATE PROCEDURE statements within the schema.