Using DataTable Editor with Sqlite

Using DataTable Editor with Sqlite

welleozean77welleozean77 Posts: 7Questions: 3Answers: 0

I am a happy (paying) user of DataTable Editor which I normally use with MySQL. I would like to switch to an SQLite database though. Has anybody managed to have DataTable Editor running with SQLite? Any fool-proof guide on how to do it?

Thank you in advance
Welle

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Answer ✓

    https://editor.datatables.net/manual/php/getting-started#Installation

    It seems to need a simple change in the configuration.

    $sql_details = array(
        "type" => "",    // Database type: "Mysql", "Postgres", "Sqlite" or "Sqlserver"
    
  • welleozean77welleozean77 Posts: 7Questions: 3Answers: 0

    Thank you. Yes, it looks promising, I've seen in lib/Database/Driver there is also a SQLite file. Good. However, ho do I set the config.php?

    $sql_details = array(
        "type" => "Sqlite",     // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
        "user" => "",          // Database user name
        "pass" => "",          // Database password
        "host" => "", // Database host
        "port" => "localhost",          // Database connection port (can be left empty for default)
        "db"   => "test.db",          // Database name
        "dsn"  => "",          // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
        "pdoAttr" => array()   // PHP PDO attributes array. See the PHP documentation for all options
    );
    

    Since the SQLite database is just a file, how do I set the path to the file? With the settings as above and the file in the same folder as the config.php file (just for testing reasons), I get the error: DataTables warning: table id=example - Ajax error. which seems to indicate no comunication with the db is in place. Thank you

  • welleozean77welleozean77 Posts: 7Questions: 3Answers: 0
    edited May 2020

    I've been able to connect. I can use Datables Editor with SQLite. It works like a charm. Thank you.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Excellent. SQLite is one of the databases we use for our unit tests, so yep, definitely works well :)

    Colin

This discussion has been closed.