ODBC DSN Connections: dsn.exe

The dsn.exe utility serves to manage ODBC data sources. The utility allows performing the following operations:

 

Location

%plesk_cli%

Usage

dsn.exe <command> [<dsn name>] [
<option 1> <param> [<option 2> <param>] … [<option N> <param>]
]

Example

The following command creates ODBC DSN connection called MSQL365 to the MS SQL Server database located on the master-sql.sample.net server, for the example.com domain:

>dsn.exe --create MSQL365 -type "SQL Server" -description "another test connection" -connection-string "DRIVER={SQL Server};SERVER={master-sql.sample.net};UID={db-admin};PWD={Pa$$w0rd};" –domain example.com

 

Commands

Command

Parameter

Description

Example

--create or -c

<name>

Creates DSN connection.

To create the tst-mysql2 connection to MySQL DSN located on the mysql.sample.net server and listening on the port 3307, under credentials admin and Pa$$w0rd:

>dsn.exe --create tst_mysql2 -type "MySQL ODBC 3.51 Driver" -description "test mysql" -connection-string "DRIVER={MySQL ODBC 3.51 Driver};Server={mysql3.sample.net};User={admin};Password={Pa$$w0rd};Port={3307};"

--update or -u

<name>

Changes DSN properties.

To change password used to establish the tst-mysql2 connection:

>dsn.exe --update tst-mysql2 -connection-string "Password={$0meth1ng};"

--remove or -r

<name>

Removes DSN connection.

To remove DSN connection called MSQL365 from domain example.com:

>dsn.exe --remove MSQL365 -domain example.com

--info or -i

<name>

Retrieves information on the specified DSN.

>dsn.exe --info MSQL365

--xml-info or -xi

<name>

Retrieves information on the specified DSN in XML format.

>dsn.exe --xml-info MSQL365

--list or -l

 

Lists existing DSNs.

Requires either of -domain, -server or -system option.

To retrieve the list of DSN connections configured in Parallels Plesk Panel on all domains:

>dsn.exe -l -server

--list-types or -lt

 

Lists allowed DSN types.

>dsn.exe -lt

--help or -h

 

Displays help on the utility usage.

>dsn.exe -h

 

Options

Option

Parameter

Description

Example

-domain

<domain name>

Specifies domain owning DSN(s).

To remove DSN connection called MSQL365 from domain example.com:

>dsn.exe --remove MSQL365 -domain example.com

-server

 

Specifies that all DSN connections registered in Parallels Plesk Panel must be listed.

To retrieve the list of DSN connections configured in Parallels Plesk Panel on all domains:

>dsn.exe -l -server

-system

 

Specifies that all DSN connections configured in the system (including those not registered in Parallels Plesk Panel) must be listed.

To retrieve the list of DSN connections configured in the system:

>dsn.exe -l -system

-description

<string>

Specifies description of the DSN connection.

To add the descriptive text for the DSN connection Common:

>dsn --update Common -description "Default connection"

-type

<string>

Specifies the DSN type.

To create the tst-mysql2 connection to MySQL DSN located on the mysql.sample.net server, under credentials admin and Pa$$w0rd:

>dsn --create tst_mysql2 -type "MySQL ODBC 3.51 Driver" -description "test mysql" -connection-string "DRIVER={MySQL ODBC 3.51 Driver};Server={mysql3.sample.net};User={admin};Password={Pa$$w0rd};"

 

-connection-string

<string>

Sets the connection string for DSN which defines the connection parameters.

The string format is as follows:

"<CONNECTION PARAMETER1>={<value1>};<CONNECTION PARAMETER2>={<value2>};[...];<CONNECTION PARAMETER n>={<value n>};"