# Database

In order to connect a database agent to aqua, you have to go through the following steps. First, extract the database agent zip file and open the <mark style="color:orange;">**aquaAgentDatabaseGui.exe.config**</mark>.&#x20;

Here, enter the agentCode and the aquaServiceURL.&#x20;

{% code overflow="wrap" %}

```csharp
  <add key="agentCode" value="yd7zhzc5bd2fiydkyu9j"/> 
  <add key="aquaServiceUrl" value="http://youraquaserver/aquaAPI/aquaagentwebservice.asmx"/> 
```

{% endcode %}

The rest of the config file is not necessary to connect the agent to aqua. The agent code is generated in aqua, and assigned to the agent.&#x20;

Next, click onto Connections in the Agent Server Configuration in order to define the database. &#x20;

<figure><img src="http://aquawiki.andagon.com/pictures/drex_database_rich_client_custom.png" alt=""><figcaption></figcaption></figure>

To create new connections and to add these databases, click on the ![](http://aquawiki.andagon.com/pictures/drex_database_rich_client_custom_2.png) button and insert a new database. &#x20;

<figure><img src="http://aquawiki.andagon.com/pictures/drex_database_rich_client_custom_3.png" alt=""><figcaption></figcaption></figure>

Within the test case, you can insert a database test script. The connection has to be defined in the drop-down box, the query has to be inserted, and there is an option to enter a check value. In order to use variables, place them between '&', e.g.: A variable called '*User*' can be used in the query or in the expected results as '*\&User&*'.

<figure><img src="http://aquawiki.andagon.com/pictures/drex_database_rich_client_custom_4.png" alt=""><figcaption></figcaption></figure>

## **MySQL example** <a href="#mysql_example" id="mysql_example"></a>

1. Download and install (full install) MySQL Connector for .Net on computer running DBAgent (<https://dev.mysql.com/downloads/connector/net/> )
2. Restart DBAgent (if already running)
3. Open aqua -> Project Configuration -> Testautomation -> Connections
4. Create new connection (Choose "Generic")
5. DataSupplier = MySql.Data.MySqlClient
6. Adjust connection string to match MySQL Setup (server, user id, password, database)&#x20;

<figure><img src="http://aquawiki.andagon.com/pictures/drex_mysql_example_custom.png" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aqua-cloud.io/documentation/automation/desktop-client/database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
