GithubHelp home page GithubHelp logo

profpatsch / hdbc-odbc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hdbc/hdbc-odbc

0.0 3.0 0.0 766 KB

ODBC driver for HDBC

License: BSD 3-Clause "New" or "Revised" License

Haskell 98.09% Makefile 0.89% C 0.52% C++ 0.50%

hdbc-odbc's Introduction

HDBC-ODBC

Welcome to HDBC, Haskell Database Connectivity.

This package provides a database backend driver for ODBC. You should be able to use any ODBC front-end with it.

Please see HDBC itself for documentation on use.

This package provides one function in module Database.HDBC.ODBC:

Connect to an ODBC server. For information on the meaning of the passed string, please see: http://msdn2.microsoft.com/en-us/library/ms715433(VS.85).aspx

connectODBC :: String -> IO Connection

For example, you might use connectODBC as follows:

connectODBC "DSN=hdbctest1"

For more information about HDBC-ODBC, please visit the wiki.

Differences from HDBC standard

None known at this time.

MySQL note

Important note for MySQL users:

Unless you are going to use InnoDB tables, you are strongly encouraged to set

Option = 262144

in your odbc.ini (for Unix users), or to disable transaction support in your DSN setup for Windows users.

If you fail to do this, the MySQL ODBC driver will incorrectly state that it supports transactions. dbTransactionSupport will incorrectly return True. commit and rollback will then silently fail. This is certainly NOT what you want. It is a bug (or misfeature) in the MySQL driver, not in HDBC.

You should ignore this advice if you are using InnoDB tables.

For the error "2013: Mysql server has gone away" error message, you'll have to use withRTSSignalsBlocked from the HDBC-mysql package.

query conn stmStr binds = withRTSSignalsBlocked $ quickQuery conn stmStr binds

Getting Started

Here are some instructions to set up ODBC with a sqlite3 backend, and how to communicate with that database with HDBC-ODBC. These instructions are written to work with Ubuntu 11.10.

First, we'll need to install the appropriate libraries:

sudo apt-get install unixodbc unixodbc-dev unixodbc-bin
sudo apt-get install libsqliteodbc

Verify that the sqlite ODBC drivers have been set up correctly:

odbcinst -q -d

This should return:

[SQLite]
[SQLite3]

Next, fire up the ODBCConfig too to set up a new DSN:

ODBCConfig

If you want to run the HDBC test suite, then set your DSN to hdbctest, and set up to connect to a database of your choice, such as an empty file in the hdbc-odbc/testsrc directory:

touch hdbc-odbc/testsrc/hdbctest.db

You can check that everything is working appropriately in ghci:

ghci> :m + Database.HDBC Database.HDBC.ODBC
ghci> conn <- connectODBC "DSN=hdbctest"
ghci> hdbcDriverName conn
"odbc"
ghci> hdbcClientVer conn
"03.52"

You can then run some tests on your database:

cd testsrc
runhaskell runtests.hs

Contributing

Contributions are welcome! If you would like to contribute, please fork the the github repository, and submit a pull request.

hdbc-odbc's People

Contributors

jgoerzen avatar zenzike avatar anton-dessiatov avatar vagifverdi avatar igrep avatar khibino avatar hesselink avatar proglang avatar profpatsch avatar bringert avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.