Command line parameters are not case sensitive.
The parameters -PROFILE
or -profile
are
identical. The usage of the command line parameters is identical between
the launcher or starting SQL Workbench/J using the java
command itself.
![]() | |
When quoting parameters on the command line (especially in a Windows® environment) you have to use single quotes, as the double quotes won't be passed to the application. |
The parameter -configDir
specifies the directory where
SQL Workbench/J will store all its settings. If this parameter is not supplied,
the directory where the default location is used.
The placeholder ${user.home}
will be
replaced with the current user's home directory (as returned by the Operating System).
If the specified directory does not exist, it will be created.
If you want to control the location where SQL Workbench/J stores the configuration files, you have to start the application with the parameter -configDir to specify an alternate directory:
java -jar sqlworkbench.jar -configDir=/export/configs/SQLWorkbench
or if you are using the Windows® launcher:
SQLWorkbench -configDir=c:\ConfigData\SQLWorkbench
The placeholder ${user.home}
will be replaced with the current user's home directory
(as returned by the Operating System), e.g.:
java -jar sqlworkbench.jar -configDir=${user.home}/.sqlworkbench
If the specified directory does not exist, it will be created.
On the Windows® platform you can use a forward slash to separate directory names in the parameter.
The -libdir
parameter defines the base directory for your JDBC drivers. The value of
this parameter can be referenced when defining a driver library
using the placeholder %LibDir%
The value for this parameter can also be set in the file workbench.settings
.
SQL Workbench/J stores the connection profiles in a file called WbProfiles.xml
.
If you want to use a different filename, or use different set of profiles for different purposes
you can define the file where the profiles are stored with the -profileStorage
parameter.
If the value of the parameter does not contain a path, the file will be expected (and stored) in the configuration directory.
The default XML format of the WbProfiles.xml
file is not intended to be edited manually.
To manage pre-defined profiles for console mode or
batch mode, it's easier to use a properties file
containing the profiles.
When specifying a properties file with -profileStorage
the file extension must
be .properties
You can define variables when starting SQL Workbench/J by either passing the variable definition directly or by passing a file that contains the variable definitions.
Defining variable values in this way can also be used when running in batch mode.
With the -varFile
parameter a definition file for
internal variables can be specified.
Each variable has to be listed on a single line in the format variable=value
.
Lines starting with a #
character are ignored (comments).
the file can contain unicode sequences (e.g. \u00fc
. Values
spanning multiple lines are not supported. When reading a file during startup
the default encoding is used. If you need to read the file in a specific encoding
please use the WbVarDef
command with the -file
and -encoding
parameter.
#Define some values var_id=42 person_name=Dent another_variable=24
If the above file was saved under the name vars.txt
, you can use those
variables by starting SQL Workbench/J using the following command line:
java -jar sqlworkbench.jar -varFile=vars.txt
A single variable can be defined by passing the parameter -variable
. This
parameter can be supplied multiple times to define multiple variables:
java -jar sqlworkbench.jar -variable=foo=42 -variable=bar='xyz'
Note that the variable definition does not need to be quoted even though it contains the =
character.
Using -variable=bar='xyz'
will include the single quotes in the variable value. The variable
definition only needs to be quoted if it contains a space:
java -jar sqlworkbench.jar -variable="foo=hello world"
If the -nosettings
parameter is specified, SQL Workbench/J will not write
its settings to the file workbench.settings
when it's beeing closed. Note
that in batch mode, this file is never written.
![]() | |
If this parameter is supplied, the workspace will not be saved automatically as well! |
You can specify the name of an already created connection
profile on the command line with the -profile=<profile name>
parameter. The name has to be passed exactly like it appears in the profile dialog
(case sensitive!). If the name contains spaces or dashes, it has to be enclosed in
quotations marks. If you have more than one profile with the same name but in different
profile groups, you have to specify the desired profile group using the -profilegroup
parameter, otherwise the first profile matching the passed name will be selected.
Example (on one line):
java -jar sqlworkbench.jar -profile='PostgreSQL - Test' -script='test.sql'
In this case the file WbProfiles.xml
must be in the current
(working) directory of the application. If this is not the case, please specify the
location of the profile using either the -profileStorage
or
-configDir
parameter.
If you have two profiles with the names "Oracle - Test"
you will
need to specify the profile group as well (in one line):
java -jar sqlworkbench.jar -profile='PostgreSQL - Test' -profilegroup='Local' -script='test.sql'
You can also store the connection profiles in a properties file
and specify this file using the -profileStorage
parameter.
You can also specify the full connection parameters on the command line, if
you don't want to create a profile only for executing a batch file.
The advantage of this method is, that SQL Workbench/J does not need the files
WbProfiles.xml
, WbDrivers.xml
to be
able to connect to the database.
Parameter | Description |
---|---|
-url | The JDBC connection URL |
-username | Specify the username for the DBMS |
-password |
Specify the password for the user
If this parameter is not specified (but |
-driver | Specify the full class name of the JDBC driver |
-driverJar | Specify the full pathname to the .jar file containing the JDBC driver |
-autocommit | Set the autocommit property for this connection. You can also
control the autocommit mode from within your script by using the
SET AUTOCOMMIT
command.
|
-rollbackOnDisconnect | If this parameter is set to true, a
ROLLBACK will
be sent to the DBMS before the connection is closed. This setting is
also available in the connection profile.
|
-checkUncommitted | If this parameter is set to true, SQL Workbench/J will try to detect uncommitted changes in the current transaction when the main window (or an editor panel) is closed. If the DBMS does not support this, this argument is ignored. It also has no effect when running in batch or console mode. |
-trimCharData |
Turns on right-trimming of values retrieved from
CHAR
columns. See the
description of the
profile properties for details.
|
-removeComments | This parameter corresponds to the Remove comments setting of the connection profile. |
-fetchSize | This parameter corresponds to the Fetch size setting of the connection profile. |
-ignoreDropError | This parameter corresponds to the Ignore DROP errors setting of the connection profile. |
-altDelimiter | This parameter corresponds to the Alternate delimiter setting of the connection profile. |
-emptyStringIsNull | This parameter corresponds to the Empty String is NULL setting of the connection profile. This will only be needed when editing a result set in GUI mode. |
-connectionProperties |
This parameter can be used to pass extended connection properties if
the driver does not support them e.g. in the JDBC URL. The values are passed as key=value pairs,
e.g.
If either a comma or an equal sign occurs in a parameter's value, it must be quoted.
This means, when passing multiple properties the whole expression needs to be quoted:
As an alternative, a colon can be used instead of the equals sign,
e.g
If any of the property values contain a comma or an equal sign, then the whole parameter value needs to be quoted again, even
when using a colon.
|
-altDelim |
The alternate delimiter to be used for this connection.
e.g. -altDelimiter=GOl to define a SQL Server like GO as the
alternate delimiter. Note that when running in batchmode you can also override
the default delimiter by specifying the
-delimiter parameter.
|
-separateConnection | If this parameter is set to true, and SQL Workbench/J is run in GUI mode,
each SQL tab will use it's own connection to the database server. This setting is
also available in the connection profile.
The default is true .
|
-connectionName |
When specifying a connection without a profile (only using -username , -password
and so on) then the name of the connection can be defined using this parameter. The connection name
will be shown in the title of the main window if SQL Workbench/J is started in GUI mode.
The parameter does not have any visible effect when running in batch or console mode.
|
-workspace | The workspace file to be loaded. If the file specification does not
include a directory, the workspace will be loaded from the
configuration directory. If this parameter
is not specified, the default workspace (Default.wksp ) will be loaded.
|
-readOnly | Puts the connection into read-only mode. |
Parameter | Description |
---|---|
-connection |
Allows to specify a full connection definition as a single parameter (and thus does not require a pre-defined connection profile). The connection is specified with a comma separated list of key value pairs:
e.g.: If an approriate driver is already configured the driver's classname or the JAR file don't have to be specified. If an approriate driver is not configured, the driver's jar file must be specified:
SQL Workbench/J will try to detect the driver's classname automatically (based on the JDBC URL).
If this parameter is specified,
The individual parameters controlling the connection behaviour
can be used together with
In addition to
|
If a value for one of the parameters contains a dash or a space, you will need to quote the parameter value.
A disadvantage of this method is, that the password is displayed in plain text on the command line. If this is used in a batch file, the password will be stored in plain text in the batch file. If you don't want to expose the password, you can use a connection profile and enable password encryption for connection profiles.