du6333137 2015-12-04 18:58
浏览 210

从PHP使用freetds时的SQL Server连接设置

I'm connecting to SQL server from Linux environment using PHP with help of FreeTDS library. And looks like some connection parameters are being explicitly turned off. Specifically, somewhere in the process these are being ran:

set quoted_identifier off
set ansi_warnings off
set ansi_padding off
set ansi_nulls off
set concat_null_yields_null off

How can I adjust connection parameters globally (either on PHP level or on FreeTDS level) to set all of the above to ON, without having to change any of the applications on the server in any way?

EDIT:

Tried suggestion with odbc.ini, does not seem to work.

Here's my freetds.conf:

[Servername]
host = hostname.example.com
port = 1433
tds version = 7.0
timeout 3600    client charset UTF-8    text size 64512

odbc.ini:

AnsiNPW = YES
QuotedID = YES

odbcinst.ini is empty

  • 写回答

1条回答

  • dqajyxqem115006813 2015-12-08 15:37
    关注

    Try adding these settings to your odbc.ini file in your server DSN (rather than freetds.conf):

    [myserver]
    ... my server settings ...
    AnsiNPW = NO
    QuotedID = NO
    

    You can see more of the settings you can change here:

    https://msdn.microsoft.com/en-us/library/ms811006.aspx

    Good luck!

    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥15 Pwm双极模式H桥驱动控制电机
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换