Download the PHP package idl-bnl-dev/db2-driver without Composer
On this page you can find all versions of the php package idl-bnl-dev/db2-driver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download idl-bnl-dev/db2-driver
More information about idl-bnl-dev/db2-driver
Files in idl-bnl-dev/db2-driver
Package db2-driver
Short Description DB2 for IBM iSeries drop-in Laravel driver
License MIT
Homepage https://github.com/idl-bnl-dev/db2-driver
Informations about the package db2-driver
[
]()
DB2 for IBM iSeries Laravel Driver
This package allows you to use Laravel's query builder and eloquent with DB2 for IBM iSeries by extending the Illuminate Database component of the Laravel framework. Originally forked from cooperl22/laravel-db2.
Requirements
- PHP 8.3+
- Laravel 13 (
illuminate/database^13.0) - PHP PDO_ODBC extension
- IBM i Access ODBC Driver (Windows & Linux)
Installation
The package is open source and available on Packagist. No extra repository configuration is needed.
Install it via composer:
The service providers are registered automatically through Laravel's package discovery.
Configuration
Add a new connection in database.php:
Note: You can specify the connection name, but the driver must be 'db2'
Note: Be sure to define the appropriate keys in
.env.
Usage
Once the connection is configured, use it like any other Laravel connection.
Query builder
Eloquent
Point a model at the DB2 connection:
Or make it the default by setting DB_CONNECTION=myDB2Connection in .env.
Schema builder
Pagination and offsets
Older IBM i releases do not support OFFSET natively. With 'offset_compatibility_mode' => true (the default) limits use FETCH FIRST n ROWS ONLY and offsets are emulated with a wrapped ROW_NUMBER() query, so skip()/offset() and paginate() work on those systems. Set it to false if your system supports LIMIT/OFFSET natively.
Read-only mode
Publish the package config:
Then set DB2_READONLY=true (or 'readonly' => true in config/db2-driver.php) to block all writes. Inserts, updates/merges, deletes and schema
changes (CREATE, ALTER, DROP, RENAME, TRUNCATE) throw IDL\DB2Driver\Exceptions\ReadOnlyModeException
before reaching the database. Selects are unaffected.
Set DB2_READONLY_ALLOW_UPDATES=true as well to permit UPDATE/MERGE statements while everything else stays blocked.
These are defaults for every db2 connection; readonly and readonly_allow_updates keys on a connection in config/database.php override them.
Troubleshooting
could not find driver/Data source name not found: make surepdo_odbcis enabled (php -m | grep odbc) and thatdriverNamematches the name of the installed ODBC driver (seeodbcinst -q -don Linux).- Wrong tables or libraries: set
schema(andDefaultLibraries/Naminginodbc_keywords) to control the library used to resolve unqualified table names. - Garbled characters: keep
CCSIDat1208(UTF-8) unless your system requires otherwise.
Testing
Contributing
Issues and pull requests are welcome on GitHub. Please run the tests and static analysis before submitting a PR.
Other Resources
License
This package is released under the MIT License. Please see License File for more information.
All versions of db2-driver with dependencies
spatie/laravel-package-tools Version ^1.13.0
illuminate/contracts Version ^13.0
illuminate/support Version ^13.0
illuminate/database Version ^13.0