Could not open connection to server

Could not open connection to server

DriverDriver Posts: 23Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
I'm trying to run DataTables with my database, but I still have this message:

Could not open connection to server

I'm sure database connection information is OK, because it is taken from other working application on my server.

What should I do to resolve the problem?

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Its almost certainly an issue on the server-side, so I'm not sure how much help we will be able to offer here in a Javascript forum :-). However, are you sure that the user you are using to connect to the server has access, that the db is running and listening on the correct ports?

    Allan
  • DriverDriver Posts: 23Questions: 0Answers: 0
    edited August 2011
    Thank you for a quick answer. :-) I think I have to contact my server administrator then. But it is weird. The data for connecting with database is the same (the user also) as in other working script on my account. Only the syntax is different:

    [code]
    define('DB_NAME', 'my_database');
    define('DB_USER', 'admin');
    define('DB_PASSWORD', 'password');
    define('DB_HOST', 'mydomain.pl:3307');[/code]

    DataTables:
    [code]$gaSql['user'] = "admin";
    $gaSql['password'] = "password";
    $gaSql['db'] = "my_database";
    $gaSql['server'] = "mydomain.pl:3307";[/code]

    This might be a problem?
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    in MySQL and other databases, users can be restricted to connect from certain hosts only. it's common to only allow a database connection from 'localhost', in which case if you try to connect from another host you will be denied.

    If you aren't the db admin, talk to your db admin and find out what you need in order to get the connection working.
  • DriverDriver Posts: 23Questions: 0Answers: 0
    edited August 2011
    MySQL server is not running locally on my hosting account, so it is normal to provide host name with port number instead of localhost. I have a connection with database but not with DataTables. This is what I don't understand.
  • DriverDriver Posts: 23Questions: 0Answers: 0
    My host administrator pointed out to me that password with the dollar wrapped in "" is interpreted by PHP. So that was the problem. Thank you for your support. :-)
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    oh, good catch. that would be confusing to debug.
This discussion has been closed.