# Creating a database connection

Create a reusable database connection in Talend Studio.

## Procedure

1. In the Repository, expand the Metadata node.
2. Right-click Db Connections and click Create connection.

   ![Repository tree view.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/create_database_connection_1.png)
3. In the list of databases, select MySQL and click Finish.
4. Enter a Name for your connection, connection\_mysql, for example.

   The name should start with connection\_ in order to create variables that can be used to create a connection in Talend Management Console.
5. Optional: Enter a Purpose and a Description.
6. Click Next.
7. Enter your database information.
   ### Example

   ![Database connection dialog box.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/create_database_connection_2.png)
8. Click Export as context to create context variables out of your database information.
   1. Select Create a new repository context and click Next.
   2. Enter a Name, Purpose and Description for your context group and click Next.
   3. Click Finish.
      ## Example

      ![Create / Reuse a context group dialog box.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/creating_db_connection_3.png)
9. Click Test connection, click OK if the test is successful, then click Finish.
10. Expand the Metadata &gt; Db Connections nodes, then right-click your connection and click Retrieve schema.
11. In the dialog box that appears, keep the default settings and click Next.
12. Select your movies table.

    ![Schema dialog box.](https://help.qlik.com/talend/en-US/api-services-getting-started-guide-api-services-platform/Resources/images/creating_db_connection_4.png)
13. Click Next, then click Finish.

## Results

Your database parameters are saved and you can reuse them in your data service.