Forum: Managing VoltDB

Post: sqlcmd scripting

sqlcmd scripting
pmilner
Nov 25, 2015
Hi, is there a good way to run some sqlcmd statements from a shell script?
I want to do something like the following in one script, to start and prepare a Volt server with my schema:

voltdb create --host= .... etc...
sqlcmd --servers=myserver --port=51234
LOAD CLASSES myClasses.jar;
FILE schema.sql;
EXIT;

Any thoughts gratefully received...
Paul
pzhao
Nov 25, 2015
pmilner,
We have a voter example that does this already: https://github.com/VoltDB/voltdb/tree/master/examples/voter
Please feel free to use what you need to achieve your goals.

Specifically, the two options you'll want to take a look at is:
run.sh server : start the server
run.sh init : compile stored procedures and load the schema and stored procedures
Peter Zhao
pmilner
Nov 27, 2015
Thanks Peter, that works fine:

sqlcmd --servers=myserver --port=50261 < myschema.sql

which will simply read the commands from the myschema.sql file.
But it looks like it will be faster with the -inlinebatch option in the myschema.sql file, which means we will have to upgrade from our current 5.0 version of VoltDB...