CREATE PROCEDURE FROM CLASS

Documentation

VoltDB Home » Documentation » Using VoltDB

CREATE PROCEDURE FROM CLASS

CREATE PROCEDURE FROM CLASS — Defines a stored procedure associated with a Java class.

Synopsis

CREATE PROCEDURE [ALLOW role-name [,...]] FROM CLASS class-name

Description

You must declare stored procedures to make them accessible at runtime. The declared procedures are evaluated and included in the application catalog when you compile the database schema.

If security is enabled at runtime, only those roles named in the ALLOW clause have permission to invoke the procedure. If security is not enabled at runtime, the ALLOW clause is ignored and all users have access to the stored procedure.

Use CREATE PROCEDURE FROM CLASS when adding user-defined stored procedures written in Java. The class-name is the name of the Java class. This class must be accessible from the classpath argument used when compiling the application catalog.

Example

The following example declares a stored procedure matching the Java class MakeReservation. Note that the class name includes its location within the current class path (in this case, as a child of flight and procedures). However, the name itself, MakeReservation, must be unique within the catalog because at runtime stored procedures are invoked by name only.

CREATE PROCEDURE FROM CLASS flight.procedures.MakeReservation;