Executing commands from file via isql

I had had a look at the documentation for isql on http://docs.openlinksw.com/virtuoso/invokingisql/ for some reason I am still lost and somewhat still unable to have isql application execute the contents of the file and exit.

Point me to the actual contents of the test.sql file (and probably of the test2.sql file too) so I may run them verbatim using the command provided.

The file I am trying to execute has the contents shown below.

UPDATE WS.WS.SYS_DAV_USER SET U_PWD='abc' WHERE U_NAME='dba';checkpoint;exit;

My command is shown below.

date;time /local/data/apps/virtuoso/7.2.6-dev/bin/isql -S 1111 -U dba -P dba /var/scripts/isql/dockercontainer_virtuoso_configuration_isql.sql;

When I execute the above command I get the isql prompt and the password of the dba user is not changed.

1 Like

The easiest way to execute such commands is with the isql EXEC command as follows:

isql 1111 dba dba exec="UPDATE WS.WS.SYS_DAV_USER SET U_PWD='abc' WHERE U_NAME='dba';checkpoint;"

which when run gives:

De-iMac-2448:~ hwilliams$ isql 1111 dba dba exec="UPDATE WS.WS.SYS_DAV_USER SET U_PWD='abc' WHERE U_NAME='dba';checkpoint;"
Connected to OpenLink Virtuoso
Driver: 07.20.3214 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.

Done. -- 0 msec.

Done. -- 18 msec.
De-iMac-2448:~ hwilliams$

or you can set the verbose=off flag to turn off the display output and just execute silently:

De-iMac-2448:~ hwilliams$ isql 1111 dba dba verbose=off exec="UPDATE WS.WS.SYS_DAV_USER SET U_PWD='abc' WHERE U_NAME='dba';checkpoint;"
De-iMac-2448:~ hwilliams$

Although to change the dba administrator password you would be better of using the set password command as indicated in the Default Password documentation as follows:

De-iMac-2448:~ hwilliams$ isql 1111 dba dba exec="set password dba abc;checkpoint;"
Connected to OpenLink Virtuoso
Driver: 07.20.3214 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.

Done. -- 3 msec.

Done. -- 23 msec.
De-iMac-2448:~ hwilliams$ 

A Virtuoso instance allows you to execute SQL commands in a file through the LOAD verb, subject to the file in question residing in a directory listed as a value of the DirsAllowed key in its INI file.

Given a file xyz.sql situated in the ~virtuoso/vad directory that contains the following command:

STATUS ();

You can run this via isql using:

isql 1111 dba dba verbose=off exec="LOAD ../vad/xyz.sql"