- 
                Notifications
    You must be signed in to change notification settings 
- Fork 17
Examples SQLite Connection
        Michael Anderson edited this page Dec 12, 2017 
        ·
        1 revision
      
    The SQLite driver connects to a local SQLite file. The SQLite driver supports transactions.
sqlite:///file_path
const Connection = require('database-js2').Connection;
var connection = new Connection('sqlite:///data.sqlite');
var Connection = require('database-js2').Connection;
(async () => {
    let connection, statement, rows;
    connection = new Connection('sqlite:///test.sqlite');
    
    try {
        statement = await connection.prepareStatement("SELECT * FROM states WHERE State = ?");
        rows = await statement.query('South Dakota');
        console.log(rows);
    } catch (error) {
        console.log(error);
    } finally {
        await connection.close();
    }
})();