Failure to connect to SQl Server from Linux

天涯浪子 提交于 2019-12-05 17:55:23
ewm

One 'gotcha' when working with linux and odbc connecting to Microsoft's SQL Server while using Microsoft's linux driver, is the string in odbc.ini for the server must contain the port as well.

 Server = [protocol:]server[,port]

as per http://msdn.microsoft.com/en-us/library/hh568455.aspx This is a different convention than most other setups that use the port = <portnumber> convention. If that is not configured, you will see a 'Could not SQLConnect' error.

Also ensure that the correct odbc files are being used.

odbcinst -j

will show configured sources and their locations.

Another gotcha you might encounter later, is the driver for SQL Server ignores user and password information in odbc.ini if it is in plain text, so make sure your application handles that.

marwin

To debug the issue try the following steps:

  1. telnet <1433>
  2. Go to SQL server network configuration
  3. TCP/IP settings
  4. right click and open Properties
  5. switch to the Network Properties tab
  6. under IPAll properties set the dynamic ports to blank and port to 1433
  7. Restart the SQL service

You can open the odbc trace and use tcpdump to catch the network package. I think the odbc trace will give a help.

The problem was that I was using EL6 driver with EL5. After installing the correct version, everything worked. Thanks any way for everyone's responses.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!