# xSQL Startup Options

> xSQL is a highly configurable utility that can run SQL scripts on local and/or remote databases, using conventional or shared memory or persistent storage, with various eXtremeDB runtime options including the choice of `MVCC` or `MURSIW` transaction managers, and `debug` or `release` libraries. xSQL can also be configured to define the network topology for and access to eXtremeDB High Availability and eXtremeDB Cluster databases.

> xSQL is configured via command line options or through a configuration file in `JSON` format. The set of command line options is relatively limited. For example it is not possible to define eXtremeDB High Availability or eXtremeDB Cluster parameters from the command line. The configuration file options are more comprehensive and reflect almost all of the eXtremeDB runtime configuration parameters available via the C API functions `mco_db_open_dev()`, `mco_cluster_db_open()`, `mco_HA_attach_master()` and `mco_HA_attach_replica()`.

> Note that command line options have precedence over the configuration file parameters. So an option present in the configuration file will be overridden by any value specified for that option on the command line.

> ## Command line arguments

> xSQL is started with a command having the following syntax (typically from directory `target/bin`):

>         xsql [LOCAL_DB_NAME | {@HOSTNAME[:PORT]}] {OPTIONS}

> When `LOCAL_DB_NAME` is specified, xSQL connects to the specified shared memory database. For example, on Unix-Linux systems:

>         ./xsql mydb

> (Note that if the database with `LOCAL_DB_NAME` does not exist, xSQL does not create a new database by default.)

> In order to connect to one or several remote databases, the `@HOSTNAME` must be specified; and if the `PORT` is not specified, the default port is `5001`. For example:

>         ./xsql @192.168.1.100:4300 @192.168.1.101

> Here xSQL connects (via distributed SQL) to two remote databases; the first on port `4300`, the second on `5001`.

> In both of the above scenarios xSQL acts as a client, i.e. it attempts to connect to existing databases. If neither a local database nor a remote database are specified, xSQL acts as a server and creates a new in-memory database.

> Please refer to Command Line Options and Configuration File Options for a complete list of the startup options available.

> ## Command line examples

> Following are some examples of possible command line arguments.

> ### Connect to the shared memory database `mydb` with the `MVCC` transaction manager:

>         ./xsql mydb -mvcc

> ### Connect as client to servers on three network nodes using the distributed SQL engine:

>         ./xsql @192.168.1.100:5000 @129.168.1.101:5000 @192.168.1.102:5000

> ### Create an in-memory database of 100 Megabytes and act as server on port 5000:

>         ./xsql -size 100m -p 5000

> ### Create a persistent shared database:

>         ./xsql -shared -size 100m -cache 200m -path mydb.dbs -log mydb.log -dbname mydb