承接 dbt/odbc-driver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dbt/odbc-driver

最新稳定版本:5.0.0

Composer 安装命令:

composer require dbt/odbc-driver

包简介

ODBC Driver for Laravel 12+

README 文档

README

A simple ODBC driver for Laravel.

Prerequisites

Enable the pdo_odbc PHP extension.

For other database engines (for instance MS SQL Server), you'll need to install the appropriate PHP extension(s).

Installation

For Laravel <=11, use version 4.0. For Laravel 12, use version 5.0.

composer require dbt/odbc-driver

Laravel will automatically discover the service provider.

Configuration

In your database.php config, configure your connection using the odbc driver:

'my-odbc-connection' => [
    'driver'   => 'odbc',
    'dsn'      => env('ODBC_DSN'),
    'host'     => env('ODBC_HOST'),
    'database' => env('ODBC_DB'),
    'username' => env('ODBC_USERNAME'),
    'password' => env('ODBC_PASSWORD'),
],

Custom Grammar

To use SQL Server or other database engines, you can set the grammars in your database.php config block for that connection:

'my-odbc-connection' => [
    ...,
    'grammar' => [
        'query' => Illuminate\Database\Query\Grammars\SqlServerGrammar::class,
        'schema' => Illuminate\Database\Schema\Grammars\SqlServerGrammar::class,
    ],
],

Usage

Use the connection like any other, via the query builder or with Eloquent.

For Eloquent, you'll need to specify the model's connection:

class Users extends Eloquent {
    /** @var string */
    protected $connection = 'odbc';
}

Connection String

You may need to use some trial and error to figure out what your connection string should look like. Consult your vendor's database documentation.

It could be a connection path:

'dsn' => 'odbc:\\\\path\to\my\database',

Or a connection name:

'dsn' => 'odbc:\\\\my-connection-name',

Or something as simple as:

'dsn' => 'odbc:dbname',

For SQL server, you'll need to specify the DSN, the user, and the password. For example:

'dsn' => 'sqlsrv:Driver=ODBC Driver 18 for SQL Server;Server=tcp:localhost,1433;TrustServerCertificate=1;Encrypt=1;'
'username' => 'sa',
'password' => 'my-super-secret-password',

Contributions & License

Contributions are welcome.

MIT Licensed. Do as you wish.

统计信息

  • 总下载量: 123.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 27
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 27
  • Watchers: 6
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固