-
Notifications
You must be signed in to change notification settings - Fork 785
ODBC
Since version 2.7.0, SQLPad has optional support for ODBC connections.
To enable this support, your setup must meet the odbc module requirements, as well as the requirements for building native modules in node.js via node-gyp.
When odbc can successfully build, an odbc option should be available on the connections page.
An initial default query (using SQL standard INFORMATION_SCHEMA) has been provided to pull the schema from your odbc connection, but it may not work with the database you are using, and you may need to provide an alternate query.
To install dependencies issue:
sudo apt-get install g++ make python-dev nodejs-dev node-gyp unixodbc-dev
- Install homebrew and required dependencies for node-gyp
- Install sqliteodbc driver (used for testing)
brew install sqliteodbc
- Find odbc files running following command
odbcinst -j
. It may be/usr/local/etc/odbc.ini
- Edit preferred INI file (system or user) to add following (path to SQLite3 driver may be different - confirm location your location)
[SQLite3] Driver = /usr/local/lib/libsqlite3odbc.so Database = /tmp/tmp_sqlpad.db
- Install driver by running
odbcinst -i -d -l -f /path/to/ini/file
See https://gist.github.com/clach04/b71a69bff18436f6d3d0bb98b9ec74b7
The tests suite for SQLPad uses SQLite3. To use sqlite, ensure the sqlite ODBC driver is installed, under Debian/Ubuntu issue:
sudo apt-get install libsqliteodbc
When creating the connection in the admin interface for Database sql to lookup schema enter:
SELECT 'dba' as table_schema, name as table_name, 'unknown' as column_name, 'unknown' as data_type FROM sqlite_master WHERE type = 'table';
NOTE column information is not available for sqlite3 when querying system catalogs.
For the connection string enter:
Driver={SQLite3};Database=/tmp/mydb.sqlite3
NOTE this sample uses a connection string. DSNs can be used but they are not required, there is no need to edit any ODBC config files for sqlite3 and UnixODBC (nor set/override ODBC environment variables).