DataTables - server side: Could not open connection to server

DataTables - server side: Could not open connection to server

coderxcoderx Posts: 45Questions: 7Answers: 0
edited March 2015 in DataTables

Hello everyone,

I am trying to get server side working. I followed these tutorials:

  1. http://www.datatables.net/examples/data_sources/server_side.html

  2. https://datatables.net/development/server-side/php_mysql

Basically I changed server side script in first example with the second example. I set my tables and database connection.

When I try to run the site I receive error in Firefox JS console:

Severity: Warning

Message: mysql_connect(): Connecting to 3.22, 3.23 & 4.0 is not supported. Server is 4.0.30-log

Error: Could not open connection to server

I use DT Editor without any problems. Is there anything I can do in order to get it working?

Thank you for reading this! :)

Peter

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I would suggest ignoring the scripts in the /development section of this site - they are all legacy. Indeed that uses the legacy mysql_connect method which has been removed in the latest PHP versions.

    Use the example from the first link you gave if you can. Failing that, just use the Editor libraries. They have built in support for server-side processing :-)

    Allan

  • coderxcoderx Posts: 45Questions: 7Answers: 0
    edited March 2015

    I would love to use Editor, because it is great. But I need to get working custom SQL query using group by, which is not supported according to this thread: http://datatables.net/forums/discussion/22998/does-editor-have-a-groupby-function.

    So I hoped I could get simple DataTables working with group by in my SQL query. :/

  • coderxcoderx Posts: 45Questions: 7Answers: 0

    I do not need to edit that data, just to display them. I can do it without DataTables, but I wanted to use them for convenience.

  • coderxcoderx Posts: 45Questions: 7Answers: 0

    You mentioned I should use the first example. :) Can I add custom SQL there?

  • coderxcoderx Posts: 45Questions: 7Answers: 0
    edited March 2015

    From the first example (http://www.datatables.net/examples/data_sources/server_side.html):

    // SQL server connection information
    $sql_details = array(
        'user' => '',
        'pass' => '',
        'db'   => '',
        'host' => ''
    );
    

    When I enter relevant data, I can see error:

    "An error occurred while connecting to the database. The error reported by the server was: SQLSTATE[HY000] [1045] Access denied for user: 'db_userip_address' (Using password: YES)"

    The same credentials work for my Editor config.php file.

  • coderxcoderx Posts: 45Questions: 7Answers: 0

    Maybe it would be best if we leave it here.

    I thought I was missing something obvious, but this could cost us a lot more time than I first anticipated, if we continue. :(

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Regarding the custom SQL with the SSP class - no, you would need to write the code directly - a bit like the legacy version does, but updated for the new style of parameters...

    Allan

  • coderxcoderx Posts: 45Questions: 7Answers: 0

    Thanks Allan, great support as usually. :)

This discussion has been closed.