JDBC Command-Line Connection Options

A number of parameters enable you to test the connection to a database by running a simple but specific query.

The ngdbc.jar file enables you execute simple commands or check if a connection to the SAP HANA database can be established with the JDBC client.

java -jar ngdbc.jar -u <user,password>
                   [-n <hostname:port>]
                   [-i <instance_number>]
                   [-d <database_name>]
                   [-o <connect option>]
                   [-c <sql command>]

Connections with an Instance Number and Database Name

The -i and -d options specify the instance number and database name (for example, tdb1) to use for the connection to SAP HANA:

java -jar ngdbc.jar -u MyUser,MyPassword1 -i 00 -n myServer -d tdb1 -c "SELECT DATABASE_NAME FROM SYS.M_DATABASES"

Connections with SYSTEMDB Port and Database Name

The -n option specifies the port number to use for connections to the SAP HANA database; the -d option enables you to provide the name of a specific database instance (for example, tdb1):

java -jar ngdbc.jar -u MyUser,MyPassword1 -n myServer:30013 -d tdb1 -c "SELECT DATABASE_NAME FROM SYS.M_DATABASES"

Connections with the SYSTEMDB Port and Database Name as a Property

The -o parameter specifies the name of a specific database instance (for example, tdb1) as a connection option:

java -jar ngdbc.jar -u MyUser,MyPassword1 -n myServer:30013 -o databaseName=tdb1 -c "SELECT DATABASE_NAME FROM SYS.M_DATABASES"