PDOException:SQLSTATE 01002 Adaptive Server连接失败(严重性9) [英] PDOException: SQLSTATE 01002 Adaptive Server connection failed (severity 9)
问题描述
我一直在关注stackoverflow上的一些答案.
I have been following some answers over stackoverflow.
我的odbc. ini(位于/etc/odbc.ini中)
My odbc. ini (located in /etc/odbc.ini)
[MSSQL]
Description = MS SQL Server
Driver = /usr/local/lib/libtdsodbc.so
Server = host.of.the.server
UID = myusername
PWD = mypassword
ReadOnly = No
Port = 1433
tds version = 8.0
我的odbcinst.ini
My odbcinst.ini
[FreeTDS]
Description = FreeTDS driver
Driver = /usr/local/lib/libtdsodbc.so
Setup=/usr/lib/odbc/libtdsS.so
FileUsage = 1
UsageCount = 1
这两个文件最初都是空的.我只是从其他线程复制了答案.
Both of these files are empty at first. I just copied answer from the other threads.
我的freetds.conf
My freetds.conf
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
; tds version = 8.0
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 8.0
# A typical Microsoft server
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
我正在使用Laravel.现在,在我使用
I am using Laravel. Now, after I used the
php artisan migrate
我收到以下错误:PDOException:SQLSTATE 01002 Adaptive Server连接失败(严重性9)
I got an error of: PDOException: SQLSTATE 01002 Adaptive Server connection failed (severity 9)
一些stackoverflow答案:可能的原因是TDS版本.
Some of stackoverflow answers: possbile cause is TDS version.
所以我用tsql -C
Version: freetds v0.91
freetds.conf directory: /usr/local/etc
MS db-lib source compatibility: yes
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 5.0
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: no
我正在使用Ubuntu 16
I am Using Ubuntu 16
推荐答案
尝试将TDS版本更改为7.0或8.0,并确保已安装以下软件包-
Try changing the TDS version to 7.0 or 8.0 and ensure that you have the following packages installed -
php5-sybase
php5-odbc
这篇关于PDOException:SQLSTATE 01002 Adaptive Server连接失败(严重性9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!