vim/dbext可以使用集成安全性而不是sql-login访问数据库 [英] Can vim/dbext use integrated security rather than a sql-login to access db

查看:123
本文介绍了vim/dbext可以使用集成安全性而不是sql-login访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我可以使用带有标准dbext插件的vim访问我们的数据库.

Currently I can access our db using vim with the standard dbext plugin.

我正在使用我们的sql-server-logins之一的详细信息来实现此目的:

I'm using the details of one of our a sql-server-logins to achieve this:

type=SQLSVR:user=userName:psswd=userPwrd:dsnname=SQLOLEDB.1:srvname=boxname

我是否可以更改此连接字符串,以便它使用我的登录凭据来访问服务器-与SSMS相似?这样,如果在此PC上安装了vim,它将使用登录该PC的任何人的详细信息来访问数据库,即,如果访问权限比我少的同事登录到此PC,则vim将使用其详细信息-他对以下计算机的访问权限因此数据将受到相应的限制.

Could I change this connection string so that it uses my login credentials to get access to the server - in a similar way to SSMS? So that if vim is installed on this pc it will use the details of whoever logs in to this pc to access the db i.e. if a colleague with less access rights than me logs in to this pc then vim will use his details - his access to the data will thus be limited accordingly.

推荐答案

@whytheq的答案适用于集成Windows身份验证",但是如果要使用

@whytheq's answer works for "Integrated Windows Authentication", but if you want to connect using Active Directory Integrated authentication, which is installed with SQL Server Management Studio, you'll need to:

  1. 通过打开PowerShell并键入get-command sqlcmd并确保源路径以C:\Program Files (x86)\开头,确保32位版本的sqlcmd.exe在您的搜索路径中.如果不是,则需要将C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn添加到系统的Path环境变量中(当然,在包含64位SQLSRV.exe的任何路径之前).

  1. Make sure that the 32 bit version of sqlcmd.exe is on your search path by opening PowerShell and typing get-command sqlcmd and making sure that the source path starts with C:\Program Files (x86)\. If if doesn't you need to add C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn to your System's Path environment variable (before any paths which include the 64 bit SQLSRV.exe, of course).

告诉dbext使用SQLSRV而不是OSQL来执行查询,方法是将其添加到您的_vimrc中(最好在augroup中作为

Tell dbext to use SQLSRV instead of OSQL to execute queries by adding this to your _vimrc (ideally in an augroup as the dbext readme suggests):

let g:dbext_default_SQLSRV_bin = 'sqlcmd'
let g:dbext_default_SQLSRV_cmd_options = '-b -G -N'

请注意,-G告诉SQLSRV使用Active Directory集成身份验证,并且-N用于加密连接.

Note that the -G tells SQLSRV to use the Active Directory Integrated Authentication, and the -N is for encrypting the connection.


在旁边:奇怪的是,从强制执行安全连接的服务器请求安全连接(-N)可能会导致错误消息指出SSL Provider: The target principal name is incorrect,在这种情况下,您需要放下-N


Aside: Oddly, requesting a secure connection (-N) from a server that enforces a secure connection can result in an error message stating SSL Provider: The target principal name is incorrect, in which case you'll want to drop the -N

这篇关于vim/dbext可以使用集成安全性而不是sql-login访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆