Laravel:连接到sybase服务器CentOS 6.7

时间:2017-09-27 19:08:40

标签: laravel centos odbc sybase freetds

我正尝试在 CentOS 6.7 上使用 Laravel(PHP 5.6)连接到Sybase服务器。

我已经安装了freetdsunixODBC

sudo yum install freetds unixODBC

并设法在命令行中与tsql连接:

TDSVER=5.0 tsql -H ServerName -p 1234 -U username

我配置了:

/etc/freetds.conf

[ServerName]
    host = ServerName 
    port = 1234
    tds version = 5.0

/etc/odbc.ini *请注意,libtdsodbc.so.0.0.0是我在/ usr / lib64中看到的文件

[ServerName]
    Driver = /usr/lib64/libtdsodbc.so.0.0.0 
    Trace = No
    Server = ServerName 
    Database = DBName
    Port = 1234
    TDS_Version = 5.0

当我与Laravel联系时,我尝试了:

$db = new \PDO("dblib:host=ServerName;port=1234;dbname=DBName", "UserName", "Pwd"); 

$db = new PDO('odbc:Driver=FreeTDS; Server=ServerName; Port=1234; Database=DBName; UID=UserName; PWD=Pwd;');

并且

't20fx' => [
        'driver'   => 'sqlsrv',
        'host'     => 'ServerName',
        'port'      => 1234,
        'database' => 'DBName',
        'username' => 'UserName',
        'password' => 'Pwd',
        'charset'  => 'utf8',
        'prefix'   => '',
    ],

每次出现could not find driver错误时......我怎么能将Laravel连接到Sybase(我讨厌这种旧技术......)??

enter image description here

0 个答案:

没有答案