关于sqlserver的sendStringParametersAsUnicode=false

jdbc:sqlserver://***;sendStringParametersAsUnicode=false

为什么会关注sqlserver的 sendStringParametersAsUnicode=false,原因是因为在做项目的过程中,发现在查询条件字符串string时,查询数条件过多,但是在开发环境查询sql正常,测试环境查询sql会卡在查询中导出查询超时,然后在测试环境上补充 sendStringParametersAsUnicode=false后可以正常的查询而研究的问题。

在sqlserver jdbc 驱动的文档发现里面有这么一个参数:
SendStringParametersAsUnicode
SendStringParametersAsUnicode={true false}. Determines
whether string parameters are sent to the SQL Server database in
Unicode or in the default character encoding of the database.
True means that string parameters are sent to SQL Server in
Unicode. False means that they are sent in the default encoding,
which can improve performance because the server does not need
to convert Unicode characters to the default encoding. You
should, however, use default encoding only if the parameter
string data that you specify is consistent with the default
encoding of the database.
The default is true

内容翻译为:

determines是否字符串参数发送到SQL Server数据库中的Unicode字符编码的或默认的数据库。TRUE意味着字符串参数发送到SQL Server中的Unicode。FALSE意味着他们发送到默认的编码,这可以提高性能,因为服务器不需要转换到Unicode字符的默认编码。你应该只使用默认的编码,但是,如果参数指定的字符串数据是一致的与你的数据库的默认编码。

简单的理解为在查询条件为字符串且查询条件过多的时候,不加sendStringParametersAsUnicode时查询条件默认会转unicode字符,在转字符时间过长而导致查询时间过长的问题,而sendStringParametersAsUnicode=false时,则用数据库的默认编码进行查询从而提高性能效率。

 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值