Skip to content

Instantly share code, notes, and snippets.

@mkoppanen
Last active December 26, 2015 14:59
Show Gist options
  • Save mkoppanen/7169243 to your computer and use it in GitHub Desktop.
Save mkoppanen/7169243 to your computer and use it in GitHub Desktop.
<?php
$location = '/mnt/hgfs/projects/test.mdb';
$dsn_name = uniqid("dsn_");
$contents=<<<EOF
[${dsn_name}]
Description = Microsoft Access Try DB
Driver = MDBTools
Database = $location
Servername = localhost
EOF;
$ini_name = '/tmp/' . uniqid ('test_ini_') . '.ini';
file_put_contents ($ini_name, $contents);
putenv ("ODBCINI=${ini_name}");
$conn = odbc_connect("$dsn_name",'','');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment