Forum: Building VoltDB Applications

Post: unexpected token: LOAD

unexpected token: LOAD
shadybroker
Jul 28, 2015
I am trying to create a stored procedure in Java, but I'm unable to. I am getting an error "unexpected token: LOAD". The steps I followed were the following.

javac -cp "/home/user/Projects/voltdb-trial/src/main/java/com/acme/voltdb/trial/dao/procedure/:/home/user/Softwares/voltdb-5.4/voltdb/*" SelectTown.java

jar cvf storedProcedures.jar *.class

export PATH=$PATH:/home/user/Softwares/voltdb-5.4/bin


cd /home/user/Softwares/voltdb-5.4/
./bin/sqlcmd


1> load classes /home/user/Projects/voltdb-trial/src/main/java/com/acme/voltdb/trial/dao/procedure/storedProcedures.jar ""

2> create procedure from class SelectTown;
Unexpected Ad Hoc Planning Error: java.lang.RuntimeException: Error compiling query: org.voltdb.planner.PlanningErrorException: SQL Syntax error in "load classes /home/user/Projects/voltdb-trial/src/main/java/com/acme/voltdb/trial/dao/procedure/storedProcedures.jar ""
create procedure from class SelectTown" unexpected token: LOAD


The following is my code inside SelectTown.java
// SelectTown.java
package com.acme.voltdb.trial.dao.procedure;

import org.voltdb.SQLStmt;
import org.voltdb.VoltProcedure;
import org.voltdb.VoltTable;

public class SelectTown extends VoltProcedure {
    public final SQLStmt selectTown = new SQLStmt("SELECT town FROM towns LIMIT ?");

    public VoltTable[] run(int limit) throws VoltAbortException {
        voltQueueSQL(selectTown, limit);
        return voltExecuteSQL(true);
    }
}
shadybroker
Jul 28, 2015
Found the cause of the error.

The generated jar package structure did not match that which was specified in the package and hence it was unable to load the classes.