Git Product home page Git Product logo

laravel-odbc-db2's Introduction

laravel-odbc-db2 (Development paused)

ODBC-based DB2 driver for Laravel5 Eloquent

Thispackage will provide an ODBC-based driver for IBM's DB2 to hopefully work on LUW (Linux Unix Windows), as opposed to IBMi.

There appear to be two ways to connect to DB2. The first uses an IBM PDO extension (via pecl), but this seems to be really old and unless you want to hack around, trying to get it to compile, it is best avoided. We'll be building an ODBC driver usin unixODBC under Ubuntu 14.04.

Details on installing DB2 Express C under Ubuntu 14.04 with no GUI

Details on bulding ODBC driver using unixODBC

Test PDO using DSN to give a 'connection succeeded' message

Once the above has been done, we need to get it working with Laravel.

  1. Install this package via composer:

    composer require opb/laravel-odbc-db2
  2. Replace the Illuminate DatabaseServiceProvider with our own in app.php:

    'providers' => [
    
    	//Illuminate\Database\DatavaseServiceProvider,
    	Opb\LaravelOdbcDb2\DatabaseServiceProvider,
  3. Add our new database config into the connections array in database.php, under the odbc key. Note that we're using .env variables, and that the odbc_driver variable is set to what we named our driver when we created it with unixODBC:

    	'odbc' => [
    		'driver'         => 'odbc',
    		'host'           => env('DB2_HOST', 'localhost'),
    		'database'       => env('DB2_DATABASE', ''),
    		'username'       => env('DB2_USER', 'db2inst1'),
    		'password'       => env('DB2_PASSWORD', 'password'),
    		'port'			 => env('DB2_PORT', 50000),
    		'schema'		 => 'DB2INST1',
    		'odbc_driver'    => 'DB2', // name of driver created by unixODBC
    	],
  4. If this is your default DB connection, remember to modify the 'default' key in database.php to reflect this.

laravel-odbc-db2's People

Contributors

ddurzo avatar opb 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.