You use the ColdFusion Administrator to quickly add a data source for use in your ColdFusion applications. When you add a data source, you assign it a data source name (DSN) and set all information required to establish a connection.
Note: ColdFusion includes data sources that are configured by default. You do not need the following procedure to work with these data sources.
Add a data source
- In the ColdFusion Administrator, select Data & Services > Data Sources.
- Under Add New Data Source, enter a data source name; for example, MyTestDSN. The following names are reserved; you cannot use them for data source names:
- service
- jms_provider
- comp
- jms
- Select a driver from the drop-down list box; for example, Microsoft SQL Server.
- Click Add.
A form for additional DSN information appears. The available fields in this form depend on the driver that you selected.
- In the Database field, enter the name of the database; for example, Northwind.
- In the Server field, enter the network name or IP address of the server that hosts the database, and enter any required Port value; for example, the bullwinkle server on the default port.
- If your database requires login information, enter your Username and Password.
Note: The omission of required username and password information is a common reason why a data source fails to verify.
- (Optional) Enter a Description.
- (Optional) Click Show Advanced Settings to specify any ColdFusion specific settings; for example, to configure which SQL commands can interact with this data source.
- Click Submit to create the data source.
ColdFusion automatically verifies that it can connect to the data source.
- (Optional) To verify this data source later, click the verify icon in the Actions column.
Note: To check the status of all data sources available to ColdFusion, click Verify All Connections.
Specifying connection string arguments
The ColdFusion Administrator lets you specify connection-string arguments for data sources. In the Advanced Settings page, use the Connection String field to enter name-value pairs separated by a semicolon. For more information, see the documentation for your database driver.
Note: The cfquery connectstring attribute is no longer supported.
Guidelines for data sources
When you add data sources to ColdFusion, keep the following guidelines in mind:
- Data source names should be all one word.
- Data source names can contain only letters, numbers, hyphens, and the underscore character (_).
- Data source names should not contain special characters or spaces.
- Although data source names are not case-sensitive, you should use a consistent capitalization scheme.
- Depending on the JDBC driver, connection strings and JDBC URLs might be case-sensitive.
- Use the Administrator to verify that ColdFusion can connect to the data source.
- A data source must exist in the ColdFusion Administrator before you use it on an application page to retrieve data.