38. Simple properties based profile storage

The default file format for saving connection profiles is XML, however when using SQL Workbench/J in batch mode or as a console application editing the XML format is tedious. Therefor it is possible to store the profiles in a "plain" properties file.

[Important]

The properties file must have the extension .properties, otherwise it will not treated as a properties file by SQL Workbench/J

The properties file can contain multiple profiles, each property key has to start with the prefix profile. The second element of the key is a unique identifier for the profile that is used to combine the keys for one profile together. This identifier can be any combination of digits and characters. The identifier is case sensitive.

The last element of the key is the actual profile property.

A minimal definition of a profile in a properties file, could look like this:

profile.042.name=Local Postgres
profile.042.driverclass=org.postgresql.Driver
profile.042.url=jdbc:postgresql://localhost/postgres
profile.042.username=arthur
profile.042.password=dent
profile.042.driverjar=postgresql-9.4-1203.jdbc41.jar

In the above example the identifier 042 is used. The actual value is irrelevant. It is only important that all properties for one profile have the same identifier. You can also use any other combination of digits and characters.

For each profile the following properties can be defined. The property name listed in the following table is the last element for each key in the properties file.

KeyValue
name

This defines the name of the connection profile which can e.g. be used with the -profile command line parameter.

This parameter is mandatory.

url

This defines the JDBC URL for the connection

This parameter is mandatory.

username

This defines the username that should be used to connect to the database

This parameter is mandatory.

password

This defines the password that should be used to connect to the database

This parameter is mandatory.

drivername

This defines the named JDBC driver as registered within SQL Workbench/J. If this is specified the corresponding driver needs to be defined and available in the WbDrivers.xml file.

Either this parameter or driverjar is mandatory.

driverjar

This specifies the jar file that contains the JDBC driver. If driverjar is specified drivername is ignored.

If the filename is not specified as an absolute file, it is assumed to be relative to the location of the properties file.

Either this parameter or drivername is mandatory.

Defining the driver jar in this way is not supported when running in GUI mode. Drivers managed through the GUI will always be saved in WbDrivers.xml

autocommit

Defines the autocommit behaviour of the connection. This defaults to false

fetchsize

Defines the fetchsize attribute of the connection.