• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to link MySQL database to .cfm page on a hosting server

Guest
Apr 16, 2009 Apr 16, 2009

Copy link to clipboard

Copied

Dear All,

I need your help to guide me how to link MySQL to the web site on the hosting server.

I’ve received an email from my hosting provider explaining what I need to put in my code in order to link MySQL database to my web site:

“In your connection string, localhost or my sql server IP is the default which is used as server name. On our server we have mapped MySQL Server IP to mysql.server
If you have a script which connects to the database or you are creating a ColdFusion DSN, than you must use mysql.server as server/hostname instead of localhost or mysql server IP. “

So far I was using MSAccess and I had not problems using it. In my new project for the first time I am using MySQL instead.

It is working fine on my developing machine (CF8 + DW + MySQL 5.0). When using MSAccess I only created variable on Application.cfm where I set Request.DSN = “dbname" without specifying any connection strings as the email suggested and it worked fine after uploading otno their hosting server.

However reading the email from the hosting company I have no clue as to how to link both MySQL database and the web site.

I would realy appreaciate if you could help me in this . Please let me know if you hav e any questions or you need more info regarding this case.

The code below is in my .cfm page:

<cfquery name="Recordset1" datasource="#Request.DSN#">

The code below is in my Application.cfm page:

<cfset Request.DSN = "dbname" />

Thanks in advance

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Apr 18, 2009 Apr 18, 2009

Finally I managed to connect to the MySQL database. I had to create db link via the hosting admin page by pointing to the right direction. No change in the code. All is working fine now.

Votes

Translate

Translate
Engaged ,
Apr 16, 2009 Apr 16, 2009

Copy link to clipboard

Copied

Does this work in the application.cfm page?

<cfset Request.DSN = "mysql.server" />

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2009 Apr 16, 2009

Copy link to clipboard

Copied

Hi,

Thanks for your replay.

I did change the Application.cfm to:

<cfset Request.DSN = "mysql.server" />

and did not work. Error - this db doesn’t exist. When I created and dumped the .sql database file from my PC to the destination hosting MySQL server I use the same name as the MS Access which was already placed above the wwwroot . The bizarre thing was that I have changed back the Application.cfm and then deleted the DB folder from the server which had MS Access db.file
Then I tried my web site again and it worked like nothing has changed. Because I have problem to login into the MySQL admin page I need to confirm that the web site is feeding from the MySQL and not MSAccess ( if somehow is still there and I can not see it
J
) If this is the case then I just should use Application.DSN
without worrying where the heck MySQL resides in the hosting server. I will keep this ticket open to verify the db once I have access to the admin page (MySQL). Other then that GREAT, I have now

Functional MySQL database on my web site and I can say ciao to the MS Access

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 17, 2009 Apr 17, 2009

Copy link to clipboard

Copied

Just checked MySQL admin page on the hosting server and nothing has changed . My web site is still using MSAccess which for some reason is hidden and I can't see it. Strange. Anyway what I am looking for is to point via either Application.cfm, or Application.cfc or via the <query> tag on the page to the MySQL database on the hosting server. In my developing PC the MySQL server is set by default to "localhost" but according to the email above after moving the tables into the hosting MySQL server then it should be point to mysql.server instead becasye it is mapped to the IP address.

How do I do this whithin my code ?

What needs to be changed/added in  the Application.cfm, or Application.cfc( if use this instead .cfm)  or the <query> tag in order to point to the hosting MySQL server ?

Common experts, I need your help. Make my weekend happy.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2009 Apr 18, 2009

Copy link to clipboard

Copied

LATEST

Finally I managed to connect to the MySQL database. I had to create db link via the hosting admin page by pointing to the right direction. No change in the code. All is working fine now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation