Changing Database Server Preferences

Use the set operation to change preferences of the database server specified by ID. You can change preferences for multiple database servers in a single packet.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet changing a database server preferences includes the set operation node:

<packet>
<db_server>
  <set>
  ...
  </set>
</db_server>
</packet>

 

The set node is presented by type DatabaseServerDescriptionOpt (plesk_db.xsd) and has the following graphical representation:

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.

  • The host node is required. It specifies new IP address or name of the database server. Data type: string.
  • The port node is required. It specifies new port of the database server. Data type: string.
  • The admin node is required. It specifies the login name of administrator of the database server. Data type: integer.
  • The password node is optional. It specifies the password of the administrator of the database server. Data type: integer.
  • The id node is required. It specifies the database server ID. Data type: integer.

Remarks

You can change preferences for multiple database servers in a single packet. Add as many set operations as the number of database servers which preferences are to be changed.

<db_server>
   <set>
   ...
   </set>
...
   <set>
   ...
   </set>
</db_server>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The set node of the output XML packet is structured as follows:

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.

  • The result node is required. It wraps the response retrieved from the server. Data type: DatabaseServerResultType (database_output.xsd).
  • The status node is required. It specifies the execution status of the set operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the set operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the set operation fails. Data type: string.
  • The id node is optional. If the set operation succeeds, it returns the ID of the database server. Data type: integer.
 

Samples

Changing preferences of a database server

This packet changes IP address of the database server specified by ID 1.

<packet>
<db_server>
 <set>
   <host>11.122.23.14</host>
   <port>3306</port>
   <admin>senior</admin>
   <password>senior</password>
   <id>1</id>
 </set>
</db_server>
</packet>

Response:

<packet>
<db_server>
 <set>
   <result>
   <status>ok</status>
   <id>1</id>
   </result>
 </set>
</db_server>
</packet>

 

If the database server with ID 1 was not found on the server, the response looks as follows:

<packet>
<db_server>
 <set>
   <result>
    <status>error</status>
    <errcode>1013</errcode>
    <errtext>Database server does not exist</errtext>
   </result>
 </set>
</db_server>
</packet>
Changing preferences of multiple database servers

This request packet changes ports of the MySQL and PostgreSQL database servers specified by ID 7 and ID 8.

<packet>
<db_server>
 <set>
   <host>localhost</host>
   <port>336</port>
   <admin>senior</admin>
   <password>senior</password>
   <id>7</id>
 </set>
 <set>
   <host>localhost</host>
   <port>337</port>
   <admin>senior</admin>
   <password>senior</password>
   <id>8</id>
 </set>
</db_server>
</packet>

 If preferences of the database server with ID 7 were successfully changed, and the database server with ID 8 was not found on the server, the response looks as follows:

<packet>
<db_server>
 <set>
   <result>
   <status>ok</status>
   <id>7</id>
   </result>
 </set>

 <set>
   <result>
    <status>error</status>
    <errcode>1013</errcode>
    <errtext>Database server does not exist</errtext>
   </result>
 </set>
</db_server>
</packet>
 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.