Giter VIP home page Giter VIP logo

odbc_adapter's Introduction

ODBCAdapter License

ActiveRecord Gem Version Branch Status
5.x ~> '5.0' master Build Status
4.x ~> '4.0' 4.2.x Build Status

Supported Databases

  • PostgreSQL 9
  • MySQL 5
  • Snowflake

You can also register your own adapter to get more support for your DBMS ODBCAdapter.register.

Installation

Ensure you have the ODBC driver installed on your machine. You will also need the driver for whichever database to which you want ODBC to connect.

Add this line to your application's Gemfile:

gem 'odbc_adapter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install odbc_adapter

Usage

Configure your database.yml by either using the dsn option to point to a DSN that corresponds to a valid entry in your ~/.odbc.ini file:

development:
  adapter:  odbc
  dsn: MyDatabaseDSN

or by using the conn_str option and specifying the entire connection string:

development:
  adapter: odbc
  conn_str: "DRIVER={PostgreSQL ANSI};SERVER=localhost;PORT=5432;DATABASE=my_database;UID=postgres;"

ActiveRecord models that use this connection will now be connecting to the configured database using the ODBC driver.

Extending

Configure your own adapter by registering it in your application's bootstrap process. For example, you could add the following to a Rails application via config/initializers/custom_database_adapter.rb

ODBCAdapter.register(/custom/, ActiveRecord::ConnectionAdapters::ODBCAdapter) do
  # Overrides
end
development:
  adapter: odbc
  dsn: CustomDB

Testing

To run the tests, you'll need the ODBC driver as well as the connection adapter for each database against which you're trying to test. Then run DSN=MyDatabaseDSN bundle exec rake test and the test suite will be run by connecting to your database.

Contributing

Bug reports and pull requests are welcome on GitHub.

Prior Work

A lot of this work is based on OpenLink's ActiveRecord adapter which works for earlier versions of Rails. 5.0.x compatability work was completed by the Localytics team.

odbc_adapter's People

Contributors

jbender avatar kddnewton avatar laithazer avatar mlarraz avatar nickelser avatar prurph 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.