unixODBC有效,但Apache无法连接

时间:2015-12-10 15:19:35

标签: sql-server apache odbc unixodbc apr

我正在尝试设置apache以连接到Microsoft SQL服务器进行身份验证。这不是理想的,但是这个遗留系统在MSSQL中具有凭据并且无法更改。我有unixODBC设置和工作

**odbcinst.ini**
[SQL Server Native Client 11.0]
Description = Microsoft SQL Server ODBC Driver V1.0 for Linux
Driver = /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0
Threading = 1
UsageCount = 1

**odbc.ini**
[mssql]
Driver = SQL Server Native Client 11.0
Server = 192.168.250.200
Database = DBName

当我使用isql连接时,我能够无问题地查询数据库

isql mssql username password

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+

在apache中我配置了以下

DBDriver odbc
DBDParams "datasource=mssql,user=username;pass=password"        
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 300

当我启动httpd时,我会在错误日志中找到它

[Thu Dec 10 09:10:35 2015] [dbd_odbc] SQLDriverConnect returned SQL_ERROR (-1) at dbd/apr_dbd_odbc.c:1146 [unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired HYT00 [unixODBC][Microsoft][SQL Server Native Client 11.0]TCP Provider: Error code 0xD 08001 [unixODBC][Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is confi 08001 
[Thu Dec 10 09:10:35.633986 2015] [dbd:error] [pid 15481] (20014)Internal error: AH00629: Can't connect to odbc: [dbd_odbc] SQLDriverConnect returned SQL_ERROR (-1) at dbd/apr_dbd_odbc.c:1146 [unixODBC][Microsoft][SQL Server Native Client 11.0]Login timeout expired HYT00 [unixODBC][Microsoft][SQL Server Native Client 11.0]TCP Provider: Error code 0xD 08001 [unixODBC][Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is confi 08001 
[Thu Dec 10 09:10:35.634054 2015] [dbd:error] [pid 15481] (20014)Internal error: AH00633: failed to initialise
[Thu Dec 10 09:10:35.634200 2015] [dbd:crit] [pid 15481] (20014)Internal error: AH00636: child init failed!

1 个答案:

答案 0 :(得分:0)

SELinux阻止了与Apache的连接。