Sunday 6 December 2009

Creating a MySQL Datasource in Coldfusion(CF) Server

Before we can create a ColdFusion datasource we need to create a empty MySQL database to point the datasource at.

Create Empty Database

To create an empty MySQL database for your ShadoCMS site use your favorite client to connect to your database server and create the database as you normally would but with the following encoding settings:

Character Set utf8
Collation utf8_unicode_ci

Create Datasource

You now need to create a new datasource in the ColdFusion Administrator and point it to the new empty database you have just created.

Login to the ColdFusion Administrator on the server at http://localhost/cfide/administrator/.

Click on the “Datasources” link in the left navigation.

Enter the name of the new site in the “Add New Datasource” box, select the "MySQL (4/5)" driver, and click "Add".

On the next screen, fill in the following connection details:

CF Data Source Name (The name of your ShadoCMS site you want to create) eg “emptysite”
Database (The name of your database) eg “emptysite”
Server (The name of your database server) eg “localhost”
Port 3306
Username [your database username]
Password [your database password]
Advanced Settings:
Connection String
Enter text: “useUnicode=true&characterEncoding=UTF-8”

Click “Submit”. You should be informed that the datasource was updated successfully.

Creating a Shado Site

Now that you have a empty database and a ColdFusion datasource setup you now need to create a ShadoCMS site.

This is the way to connect mysql to Coldfusion server's datasource.