Data tables with MSSQL
Data tables with MSSQL
I am trying to connect datatables with mssql but i am having a bit of an issue. Any insights. see errors below:
call_user_func() expects parameter 1 to be a valid callback, class 'DataTables\Database\DriversqlsrvQuery' not found in "path/database" line 65
Cannot redeclare class DataTables\Database\SqlserverQuery in "path/Database/Driversqlsrv/Query.php" on line 0
This discussion has been closed.
Replies
I think the issue is probably the
type
option in theconfig.php
file. It is case sensitive and for SQL Server it should be:I suspect you have it as all lowercase at the moment.
Allan
I made the change but now the driver is unknown
Fatal error: Uncaught exception 'Exception' with message 'Unknown database driver type. Must be one of Mysql, Oracle, Postgres, Sqlite, sqlsrv' in path/Database/Database.php:56
That's weird. This is the code that it uses to sent that error:
It shouldn't be possible for it to output
sqlsrv
at that point in the code.Could you show me your full config.php file please?
Allan
I am using laravel 5 and i just checked my database config and my driver for my default db is "sqlsrv". Im thinking if that might be my issue.
see config.php below
`<?php if (!defined('DATATABLES')) exit(); // Ensure being used in DataTables env.
/*
* DB connection script for Editor
* Created by http://editor.datatables.net/generator
*/
// Enable error reporting for debugging (remove for production)
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
* Edit the following with your database connection options
*/
$sql_details = array(
"type" => "Sqlserver",
"user" => "testuser",
"pass" => "pass123",
"host" => "test",
"port" => "",
"db" => "testdatatbldb",
"dsn" => ""
);`
Your
$sql_details
looks fine there.Do you have the
sqlsrv
PDO driver installed in your PHP? You can check by using aphpinfo()
file and checking the PDO section.Allan