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

Cannot connect Coldfusion 9 to MySql 5 in Apache (Ubuntu)

Participant ,
Jun 10, 2010 Jun 10, 2010

Copy link to clipboard

Copied

When trying to verify my datasource int he coldfusion admin panel I get the following error:

Connection verification failed for data source: dsnallcars
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
The root cause was that: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

I can serve phpMyAdmin and play around with the tables in there so I know Apache and MySql are working. I've got the coldfusion administrator and also a normal coldfusion error serving this message:

The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request

Error Executing Database Query.

Could not create connection to database server. Attempted reconnect 3 times. Giving up.

So I know that's working as well. My settings in the administrator are:

JDBC URL: jdbc:mysql://localhost:3306/allcars

Driver class: com.mysql.jdbc.Driver

I know the user name and password are correct, as I use them in phpMyAdmin.

I've got the mysql-connector-java-5.1.12.bin.jar file pasted into /opt/coldfusion9/wwwroot/WEB-INF/lib

I'm at a complete loss as to what to do next. Anyone have any ideas? I can provide the stack trace from the error if it helps or any other info if needs be.

Views

4.3K

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
Contributor ,
Jun 10, 2010 Jun 10, 2010

Copy link to clipboard

Copied

Go back into the CF Administrator and click on Data Sources and make sure your data source is still listed in there.

I have your exact same setup at home, and for some reason, when I stop and restart the ColdFusion server, I randomly lose datasources.  I'm not sure what's causing it, but it's not a huge deal to me since I just use it for development purposes.

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
Participant ,
Jun 10, 2010 Jun 10, 2010

Copy link to clipboard

Copied

My Data source is still there and still can't communicate with CF, after Apache, Coldfusion and system reboots.

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
Jun 10, 2010 Jun 10, 2010

Copy link to clipboard

Copied

I've had a same error before with the similar setup except for it was running on debian which is almost the same thing, and the way i fixed it was by changing the ip it connects to, so instead of using localhost to connect to the db, try using the physical ip even if its on the same box. I don't know why but it fixed it for me.

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
Participant ,
Jun 14, 2010 Jun 14, 2010

Copy link to clipboard

Copied

Hmm no that didn't change anything. I assume you meant something like the following

jdbc:mysql://192.168.1.19:3306/dbname

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
LEGEND ,
Jun 14, 2010 Jun 14, 2010

Copy link to clipboard

Copied

From the CF server, can you telnet onto the IP & port that the MySQL server is listening on?

--

Adam

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
Participant ,
Jun 14, 2010 Jun 14, 2010

Copy link to clipboard

Copied

From putty, if I type telnet 192.168.1.19, which is the ip of the cf server I'm logged into, I get

Unable to connect to remote host: Connection refused

From putty, if I type telnet 192.168.1.19 3306, I get

Trying 192.168.1.19...

Connected to 192.168.1.19.

Escape character is '^]'.

EHost '192.168.1.19' is not allowed to connect to this MySQL serverConnection closed by foreign host.

And I have no idea what that means

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
LEGEND ,
Jun 14, 2010 Jun 14, 2010

Copy link to clipboard

Copied

It means that the CF server can make a network connection to the MySQL server.

Does MySQL log anything when these connections fail?

--

Adam

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
Participant ,
Jun 22, 2010 Jun 22, 2010

Copy link to clipboard

Copied

The /var/log files has mysql.err and mysql.log, both of which are empty.

The my.cnf file does not have any of the log lines commented out.

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
Participant ,
Jul 08, 2010 Jul 08, 2010

Copy link to clipboard

Copied

Anyone else got any ideas?

I can access MySql through the command line and with phpMyAdmin

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
Participant ,
Jul 20, 2010 Jul 20, 2010

Copy link to clipboard

Copied

LATEST

It's a permissions problem. The IP needed to be 192.168.1.19 in the DSN setup in the administrator, but that didn't fix it alone.

I also created a 'temp' MySQL user based on a post found here: http://www.linuxquestions.org/questions/showthread.php?p=4039359#post4039359

And used that instead, it worked.

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