Skip to content
Branch: master
Find file History
Linl
Linl update
Latest commit b09c35a Jul 11, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src update Jun 10, 2019
test_setup update Jun 10, 2019
tests update Jun 10, 2019
windows mssql odbc guide update Jun 10, 2019
DolphinDBODBC.txt update Jun 10, 2019
Makefile update aws, odbc, zlib Aug 11, 2018
README.md update Jul 11, 2019
myodbcTutorial.txt update aws, odbc, zlib Aug 11, 2018
odbc.cfg exec = execute May 14, 2018
postgresqlTutorial.txt
utfcpp_LICENSE update Jun 10, 2019

README.md

DolphinDB ODBC plugin

使用该插件可以方便的从ODBC支持的数据库中迁移数据至dolphinDB中.

With this plugin, you can easily pull your data from existing databases that support ODBC interface.

Prerequisites

This plugin requires corresponding database drivers for ODBC.

Ubuntu

# install unixODBC library
apt-get install unixodbc unixodbc-dev

# SQL Server ODBC Drivers
apt-get install tdsodbc

# PostgreSQL ODBC ODBC Drivers
apt-get install odbc-postgresql

# MySQL ODBC Drivers
apt-get install libmyodbc

# SQLite ODBC Drivers
apt-get install libsqliteodbc

Compilation

To compile the plugin, type following command in a shell.

make

This will compile the plugin into a shared library named libPluginODBC.so.

Loading plugin into DolphinDB

You can use dolphindb's loadPlugin function to load the plugin. This function takes a plugin description file parameter. For example, the follwing dolphindb script loads the plugin described by DOlphinDBODBC.txt.

loadPlugin("DolphinDBODBC.txt");

Using the plugin

The plugin provides three functions.

odbc::connect(connStr)

odbc::connect takes a odbc connection string as the paramter and opens up a connection via ODBC with this string and return the connection handle to user. For more information regarding the format of connection string, see https://www.connectionstrings.com/ ;

odbc::close(connHandle)

odbc::close closes an odbc connection associated with the handle.

odbc::query(connHandle or connStr, querySql [,t])

odbc::query queries the database via connHandle or connStr and return the results as a dolphindb table.
The first argument could be connection handle or a connection string.
The second argument is the query string.
The last argument is a optional user-provided table. If provided, query results will be appended to the table. Note that, the table schema must be compatible with the results returned from ODBC or an exception will be thrown.

You can ommit odbc:: prefix by introducing obdc module namespace.

use odbc;
You can’t perform that action at this time.