ColdFusion and MySQL
ColdFusion comes with the ability to connect to a
MySQL database using ODBC.
Creating an ODBC Connection in ColdFusion
The first step in using MySQL with ColdFusion is to create the MySQL user, password, and database that ColdFusion
will be using. Once that is done, follow the instructions below to connect ColdFusion to your MySQL database.
-
Go to the following URL to access the ColdFusion administration tools.
http://YOUR-DOMAIN.NAME/cfide/administrator
-
After logging in using your administrator password, click on ODBC under the Data Sources heading in
the left menu bar.
-
On the left menu bar, under data sources, click ODBC. The ODBC Data
Sources Available to ColdFusion page will be displayed.
-
To add a mySQL database, enter the data source name in the Data Source Name text
box. The data source name can be any of your choice.
-
Enter a name for your connection in the Data Source Name text box, then select myODBC mySQL Driver
as your driver in the ODBC Drivers drop down box.
-
When you click the Add button, the Create ODBC Data Source [myODBC mySQL Driver] page will appear.
The Data Source Name text box should already be filled out with the name you gave earlier.
-
The Description field is for your own reference, and should be something to help you remember what the
connection is used for.
-
In the Database Name text box, enter the exact name (including capitalization) of your MySQL database.
-
The Server Host Name text box is where you will need to provide the name of the
server that your database is on. If your database is on the same server, use the default
Local Host.
-
The Server Porttext box should remain 3306. If your database is on a different
server and you know the port number, make the necessary changes to use the correct port.
-
When you click the CF Settings button, a new screen will load with additional fields. Enter the
MySQL Username and Password you created earlier into the appropriate fields.
-
When you click the Create button, the connection will be added, and you should see the new connection in
the available data source list with Verified beside it to indicate that the connection works properly.
|