Server Side processing fail to connect to SQL server

Server Side processing fail to connect to SQL server

LesteryamLesteryam Posts: 2Questions: 2Answers: 0

Hi, I have my own database with my own set of data and I'm trying to connect it to my sql server. However, i kept getting this error:

DataTables warning: table id=dataTable - An error occurred while connecting to the database. The error reported by the server was: SQLSTATE[HY000] [2006] MySQL server has gone away

I have triple checked my database username, password, database and host and its all correct.

Below is my php code:

<?php
$sql_details = array(
        "type" => 'Sqlserver',
    'user' => 'xxxxx',
    'pass' => 'xxxxxx',
        'db'   => 'consumption',
       'host' => '43.xxx.xx.xxx',
    'port' => '1533'
);

$table = 'CONSUMPTION';

$primaryKey = 'id';


$columns = array(
    array( 'db' => 'id', 'dt' => 0 ),
    array(
        'db'  => 'consumption_date',
        'dt'        => 1,
        'formatter' => function( $d, $row ) {
            return date( 'y-m-d', strtotime($d));
        }
    ),
    array( 'db' => 'vessel_type', 'dt' => 2 ),
    array( 'db' => 'vessel_name', 'dt' => 3 ),
    array( 'db' => 'working_hours', 'dt' => 4 ),
    array( 'db' => 'standby_hours', 'dt' => 5 ),
    array( 'db' => 'off_hours', 'dt' => 6 ),
    array( 'db' => 'hours_remark', 'dt' => 7 ),
    array( 'db' => 'rob_start_day', 'dt' => 8 ),
    array( 'db' => 'rob_end_day', 'dt' => 9 ),
    array( 'db' => 'vessel_into', 'dt' => 10 ),
    array( 'db' => 'bunkering_into', 'dt' => 11 ),
    array( 'db' => 'bunkering_out', 'dt' => 12 ),
    array( 'db' => 'bunkering_to', 'dt' => 13 )
);



require( 'ssp.class.php' );

echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

?>

Can anyone help to see whats wrong?

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    This thread should help, it's asking the same thing. Also here.

    Cheers,

    Colin

This discussion has been closed.