VoltDB Home » Documentation » Using VoltDB


IMPORT CLASS — Specifies additional Java classes to include in the application catalog.


IMPORT CLASS class-name


Warning: Deprecated

The IMPORT CLASS statement is only valid when precompiling a schema into an application catalog. However, use of precompiled catalogs, and the IMPORT CLASS statement, are deprecated. When using interactive DDL to enter your schema, use the sqlcmd load classes directive instead.

The IMPORT CLASS statement lets you specify class files to be added to the application catalog when the schema is compiled. You can include individual class files only; the IMPORT CLASS statement does not extract classes from JAR files. However, you can use Ant-style wildcards in the class specification to include multiple classes. For example:

IMPORT CLASS org.mycompany.utils.*;

Use the IMPORT CLASS statement to include reusable code that is accessed by multiple stored procedures. Any classes and methods called by stored procedures must follow the same rules for deterministic behavior that stored procedures follow, as described in Section 5.1.2, “VoltDB Stored Procedures are Deterministic”.

Code imported using IMPORT CLASS is included in the application catalog and, therefore, can be updated on a running database through the @UpdateApplicationCatalog system procedure. For static libraries that stored procedures use but that do not need to be modified often, the recommended approach is to include the code by placing JAR files in the /lib directory where VoltDB is installed on the database servers.


The following example imports a class containing common financial algorithms so they can be used by any stored procedures in the catalog: