How to: Configure Connections to External Databases
In Application Designer, you can configure connections between applications and databases. By adding databases to the application diagram, you can visualize, document, connect them to applications that reference them, and include them as part of an application system design. For more information, see Defining Applications on Application Diagrams and Communication Between Applications.
When a database is connected to an application, a database consumer endpoint appears on the application. You can then specify a connection string for the database consumer endpoint. It is not required for two applications that are connected to the same database to have the same connection string. For more information, see How to: Connect Applications on Application Diagrams and Overview of Endpoints on Applications.
If a data source and provider have not been chosen, the Choose Data Source dialog box appears so you can choose a data source and provider. Otherwise, the Connection Properties dialog box appears so you can configure the connection string. Though you can cancel these two tasks and create the connection, make sure you configure the connection before executing code that requests the connection.
To choose a data source and provider
- In the Choose Data Source dialog box, select the data source and provider for the connection and click Continue.
For more information, see Choose/Change Data Source Dialog Box.
To configure the connection string
In the Connection Properties dialog box, configure the settings for the connection string and click OK.
A connection line with an arrow shows direction of communication from consumer to provider endpoint. In the Properties window, the Connection String property of the database consumer endpoint displays the connection string. In the Settings and Constraints Editor, the ConnectionStringsSection setting is also added to the application definition under the Application Settings, Directory, and then Configuration node.
For more information, see the following topics:
To edit the connection string
On the diagram, select the database consumer endpoint.
On the Diagram menu, point to Implementation, and choose Define Connection String.
You can also right-click the database consumer endpoint and choose Define Connection String.
In the Connection Properties dialog box, edit the connection string and click OK.
The connection string reflects the changes you made.
You can also edit the connection string in the Properties window by clicking the ellipsis (…) button for the Connection String property. Once the application is implemented, you can also edit the connection string from the application's configuration file. For more information, see How to: Implement Applications on Application Diagrams.
Once an application with one or more database consumer endpoints is implemented, any connection strings that are configured for its database consumer endpoints will appear in the connectionStrings section of the application's configuration file. By default, these connection strings are written unencrypted to the file. For more information, see Considerations for Implementing Applications.