我使用MacVim和dbext插件连接到Oracle,它运行良好。现在我需要连接到MS SQLServer,
但显示错误:Connection: T(SQLSRV) H(localhost) U(user) at 14:38/bin/bash: osql: command not found
有人知道怎么做吗?
最佳答案
确保您具有FreeTDS CLI程序之一。我认为tsql比osql具有更全面的功能,但相同的方法应适用于任何一种。
创建一个shell脚本来包装tsql。将其放在您的路径中。
然后将dbext配置值添加到您的.vimrc
" I'm using mssql.sh as the wrapper program.
" Re-title to whatever you name yours
let g:dbext_default_SQLSRV_bin = "mssql.sh"
" FreeTDS options for osql/tsql are not as feature rich as dbext expects
let g:dbext_default_SQLSRV_cmd_options = ' '
" set 'host' in you profile to the FreeTDS server config, which will be altered in the script
我打过的包装纸没什么特别的,但经过测试可以正常工作。
#!/bin/bash
# -S is better for FreeTDS then -H
options=$( echo $@ | sed -e 's/-H /-S /' -e 's/ -i.*//' )
# osql/tsql in freetds don't seem to accept a file flag
sql_scratch=$( echo $@ | sed 's|^.* -i||' )
# and execute...
cat $sql_scratch | tsql $options
关于sql-server - 如何在Mac OSX上使用Vim dbext连接到MS SQLServer?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5659687/