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 stm32开发clion时遇到的编译问题
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法