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

  • creating, modifying, and removing DSN connections
  • getting info on a DSN in plain-text or XML format
  • listing DSN connections configured on a particular domain or on the whole server
  • listing types of DSN connections supported on the server

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:

plesk bin 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:

plesk bin 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:

plesk bin 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:

plesk bin dsn.exe --remove MSQL365 -domain example.com

--info or -i <name> Retrieves information on the specified DSN.

plesk bin dsn.exe --info MSQL365

--xml-info or -xi <name> Retrieves information on the specified DSN in XML format.

plesk bin 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 Plesk on all domains:

plesk bin dsn.exe -l -server

--list-types or -lt   Lists allowed DSN types.

plesk bin dsn.exe -lt

--help or -h   Displays help on the utility usage.

plesk bin 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:

plesk bin dsn.exe --remove MSQL365 -domain example.com

-server   Specifies that all DSN connections registered in Plesk must be listed.

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

plesk bin dsn.exe -l -server

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

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

plesk bin dsn.exe -l -system

-name <string> Specifies data source name

To set the name for the data source for the DSN connection Common:

plesk bin dsn.exe --update Common -name "Default data source"

-description <string> Specifies description of the DSN connection.

To add the descriptive text for the DSN connection Common:

plesk bin dsn.exe --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:

plesk bin 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};"

-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>};"