We help IT Professionals succeed at work.

how to work with a remote mysql database ??

altariamx2003
on
93 Views
Last Modified: 2017-03-13
I got two servers: "www.grupossc.com" with linux and "www.pvtcloudlab.com" with windows

in pvtcloudlab.com the page load his own database but also the mysql databse located in "www.grupossc.com", most of the time the system works without problems, but from time to time the page show you this error:
Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Inetpub\vhosts\pvtcloudlab.com\httpdocs\users\Connections\dbnotes1.php on line 16

Fatal error: in C:\Inetpub\vhosts\pvtcloudlab.com\httpdocs\users\Connections\dbnotes1.php on line 16

Open in new window


that error reffers to this line:
$dbnotes1 = mysql_connect($hostname1, $username1, $password1) or trigger_error(mysql_error(),E_USER_ERROR);
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_dbnotes = "localhost";
$database_dbnotes = "xxxxxx";
$username_dbnotes = "xxxxxx";
$password_dbnotes = "xxxxxx";
$dbnotes = mysql_connect($hostname_dbnotes, $username_dbnotes, $password_dbnotes) or trigger_error(mysql_error(),E_USER_ERROR); 


$hostname1 = "www.grupossc.com";
$database1 = "xxxxxx";
$username1 = "xxxxxx";
$password1 = "xxxxxx";
$dbnotes1 = mysql_connect($hostname1, $username1, $password1) or trigger_error(mysql_error(),E_USER_ERROR);
?>

Open in new window


Anyone know why this error happend but just sometimes??? and it is  a way to solve it??????
Comment
Watch Question

John TsioumprisIT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Are you sure the server  with Linux works correctly...have checked if this is an network connectivity issue....is logging for MySQL working?

Author

Commented:
hi john thx for your time.

As far as i know all work ok, this problems sometimes emerges when i try to connect the base in pvtcloudlab.com from grupossc.com
John TsioumprisIT Supervisor
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
The "sometimes" points to something between pvtcloudlab and grupossc...i don't think its MySQL's fault...to ensure that there are several stress test floating on the Internet...
Most Valuable Expert 2011
Author of the Year 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions