Navigation:  The Server in depth > Server Extended Settings > Remote Command Handler > Server Side Pascal Scripts and NxCommand >

NxCommand

Previous pageReturn to chapter overviewNext page

nxCommand.exe

 

This nifty utility is an extended command line implementation that can be used to call NexusDB server side scripts. The command line arguments are as following:

 

nxCommand /Type:cmdExecScript /Script:myscript.nxscript [/param1:asneededbythescript ...] /User:UserName /Password:Password
[/Server:nexusdb@127.0.0.1];

 

nxcommand

 

Script Repository

 

There are two scripts supplied with the server engine

The first script runSQL.nxscript will execute a SQL command and allow to format the output with delimeters, quoting etc. This can be used to very quickly export some data to a CSV (or similar) file. Please look at the preliminary source for the details. You can call it like this (for a local server with no user/password):

 

nxCommand /Type:cmdExecScript /Script:runsql.nxscript /database:dbname /sql:"select * from t1" /delimiter:%20 /qualifier:%22 /User:UserName /Password:Password > export.txt

 

This will create nice CSV formated file of the given query. It could be possible to extend this script to output data to an accounting package, whilst updating the appropriate tables to indicate that the export had been completed.

 

The second script is Backup.nxscript which can be used in the pre-backup event of your favourite backup solution to create a consistent backup of your database. Call it like that:

 

nxCommand /Type:cmdExecScript /Script:Backup.nxscript /Source:srcalias|srcpath /Destination:destalias|destpath /User:UserName /Password:Password

 

nxCommand returns, like a good command line utility, an error code<>0 if something didn't work as expected and dumps the error message to STDOUT/STDERR.

 

It is possible for other scripts to be written either in house or via our consultancy service to manipulate the data through external processes.