seneca-msaccess-store

Seneca store plugin to connect to a Microsoft Access database

Usage no npm install needed!

<script type="module">
  import senecaMsaccessStore from 'https://cdn.skypack.dev/seneca-msaccess-store';
</script>

README

seneca-msaccess-store

Based on seneca-mysql-store, seneca-oracle-store and seneca-sybase-store.

This project uses odbc to connect to Microsoft Access. Currently the odbc driver options for OSX/Linux to communicate to Microsoft Access are grim, therefore this module will only work in a Windows enviroment.

Tested on:

  • node@0.10.26
  • seneca@0.6.1

Prerequisites

Install

With npm:

npm install seneca-msaccess-store

Usage


var seneca = require('seneca')();

/*
 * Connection options
 * For information on access odbc connection strings:
 * https://www.connectionstrings.com/access/
 */

//using a connection string
seneca.use('msaccess-store', {
  connection: 'Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=w:\\seneca-msaccess-store\\test\\TestDB.accdb;'
});

//or pass the connection details as an object
seneca.use('msaccess-store', {
  connection: {
    driver: '{Microsoft Access Driver (*.mdb, *.accdb)}',
    dbPath: 'w:\\seneca-msaccess-store\\test\\TestDB.accdb',
    user: '',
    password: ''
  }
});

/**
 * Pool options
 * For more information on its options see https://github.com/coopernurse/node-pool
 */
seneca.use('msaccess-store', {
  connection: {
    driver: '{Microsoft Access Driver (*.mdb, *.accdb)}',
    dbPath: 'w:\\seneca-msaccess-store\\test\\TestDB.accdb',
    user: '',
    password: ''
  },
  pool: {
    min: 1,
    max: 10,
    log: true,
    idleTimeoutMillis: 10000 // specifies how long a resource can stay idle in pool before being removed
  }
});

/**
 * Creating and saving an 'apple' entity
 */

seneca.ready(function(){
  var apple = seneca.make$('fruit')
  apple.name  = 'Pink Lady'
  apple.price = 0.99
  apple.save$(function(err,apple){
    console.log( "apple.id = "+apple.id  )
  })
})

TODO

  • Tidy up entityFactory
  • Sql, sort and limit tests from seneca store tests
  • Native tests, specific to ms access

Acknowledgements

nearForm