Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are two options to to specify which database to connect to:

  • Using a connection already defined by the GUI DbVisualizer tool. This is done by using the -connection parameter. If you have forgot the connection name, use the -listconnections option to get a list of all connection existing names.
  • Specifying the connection properties by using the parameter -url. The -url parameter specifies the JDBC URL for the database to connect to. For information about the JDBC url see Setting Up a Connection Manually. There are also some examples below showing how to specify connection properties using the -url parameter

Examples

Executing single statements

...

As an alternative to using a connection already set-up through GUI the DbVisualizer tool you may use the -url parameter. In combination with the parameters -drivername, -driverclass, and -driverpath this parameter  these parameters enables you to get connected connect without prior specification using the GUIDbVisualizer tool.

Following are some examples.

Executing SQL towards a MYSQL MySQL instance running on localhost port 3306. The parameter "-drivername MYSQL" specifies  specifies that we are using a drive JDBC driver specified in the GUI DbVisualizer tool named MYSQL. For listing of the existing drivers use the GUI Driver Manager. See  Tools->Driver Manager in the DbVisualizer tool. Read more in Installing a JDBC Driver

Code Block
languagebash
titleUsing -url and -drivername parameters
./dbviscmd.sh -url jdbc:mysql://localhost:3306/ -drivername MYSQL -sql "select * from sakila.actor"  -userid root

An alternative to use the -drivername you may use the parameters -driverclass and -driverpath to specify the JDBC driver.

Code Block
languagebash
titleUsing -driverclass and -driverpath parameters
./dbviscmd.sh -url jdbc:oracle:thin:@localhost:1521/ORCL -driverclass oracle.jdbc.OracleDriver -driverpath "/tmp/my_oracle_driver/ojdbc6.jar:/tmp/my_oracle_driver/orai18n.jar:/tmp/my_oracle_driver/xdb.jar:/tmp/my_oracle_driver/xmlparserv2.jar" -sql "select * from HR.COUNTRIES"  -userid system -password oracle

The above example connects to an ORACLE Oracle instance on localhost and port 1521. Note that the separator character ':' between the different jar files is platform dependant. On Windows-based desktop platforms, the value of this field is the semicolon (";)"