The command-line Ping utility dbping assists in diagnosing connection problems.
dbping [options]
The following table lists the available options for the dbping utility.
Option |
Description |
---|---|
–c "keyword=value; ..." |
Supply database connection parameters |
–d |
Make a database connection if the server is found |
–l library |
Use the specified ODBC driver or driver manager library |
–m |
Use the ODBC Driver Manager. Otherwise, connect using embedded SQL. |
–o filename |
Log output messages to a file |
–pc property,… |
Report specified connection properties |
–pd property,… |
Report specified database properties |
–ps property,… |
Report specified database server properties |
–q |
Operate quietly—do not print messages |
–z |
Display debugging information |
The dbping utility is a tool to help debug connection problems. It takes a full or partial connection string and returns a message indicating whether the attempt to locate a server or database, or to connect, was successful.
The utility can be used for embedded SQL or ODBC connections. It cannot be used for jConnect (TDS) connections.
Exit codes are 0 (success) or non-zero (failure).
This utility accepts @filename parameters.
Connection parameters (-c) For a description of the connection parameters, see Chapter 4, “Connection and Communication Parameters” in the Sybase IQ System Administration Guide. If no connection parameters are specified, connection parameters from the SQLCONNECT environment variable are used, if set.
Make database connection (-d) Ping the database, not just the server.
If you do not supply the -d option, then dbping reports success if it finds the server specified by the -c option. If you do supply the -d option, then dbping reports success only if it connects to both server and database.
For example, if you have a server named blair running the database sample, the following succeeds:
dbping -c "eng=blair;dbn=sample"
The following command fails, with the message Ping
database failed -- specified database not found
dbping -d -c "eng=blair;dbn=sample"
Load specified library (–l) Specify the library to use (without its file extension). This option avoids the use of the ODBC driver manager, and so is particularly useful on UNIX operating systems.
For example, the following command loads the ODBC driver directly:
dbping –m –c "dsn=ASIQ12 Sample" –l dbodbc9
On UNIX, if you wish to use a threaded connection library, you must use the threaded version of the Ping utility, dbping_r.
Use ODBC to connect (-m) Establish a connection using ODBC. By default, dbping attempts a connection using the embedded SQL interface.
Report connection properties (–pc) Upon connection, display the specified connection properties. Supply the properties in a comma-separated list. You must specify enough connection information to establish a database connection if you use this option.
For a list of connection properties, see “Connection-level properties” in Adaptive Server Anywhere Database Administration Guide.
For example, the following command displays the DIVIDE_BY_ZERO_ERROR option setting, which is available as a connection property.
dbping –c ... –pc Divide_by_zero_error
Report database properties (–pd) Upon connection, display the specified database properties. Supply the properties in a comma-separated list. You must specify enough connection information to establish a database connection if you use this option.
For a list of database properties, see “Database-level properties” in Adaptive Server Anywhere Database Administration Guide.
For example, the following command displays the Java version in use by the database:
dbping –c ... –pd JDKVersion
Report database server properties (–ps) Upon connection, display the specified database server properties. Supply the properties in a comma-separated list.
For a list of database server properties, see “Server-level properties” in Adaptive Server Anywhere Database Administration Guide.
For example, the following command displays the command line that was used to start the server:
dbping –c ... –ps CommandLine
Log output messages to file (–o) Write output messages to the named file.
Operate quietly (–q) If dbping fails, a message is always displayed. If succeeds, no message appears if –q is specified.
Display debugging information (–z) This option is available only when an embedded SQL connection is being attempted. That is, it cannot be combined with –m or –l. It displays the network communication protocols used to attempt connection, and other diagnostic messages.