c# 通过VPN的DB连接字符串
我正在尝试通过 VPN 连接到另一个网络上的数据库。如何设置连接字符串?有一个网络密码可以进入网络,然后有一个数据库密码可以连接。有办法设置吗?
<connectionStrings>
<add name="remoteDB" connectionString="eng=INV;Links=tcpip(Host=xxx.xxx.xx.xx,xxxx);uid=userid;pwd=password"/>
</connectionStrings>
I am trying to connect to a database on another network through a vpn. How do I set up the connection string? There is a network password to get on the network and then a database password to connect. Is there a way to set this up?
<connectionStrings>
<add name="remoteDB" connectionString="eng=INV;Links=tcpip(Host=xxx.xxx.xx.xx,xxxx);uid=userid;pwd=password"/>
</connectionStrings>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有标准的方法可以将 VPN 连接设置定义为连接字符串的一部分。您正在使用的特定数据库提供程序可能有一种方法(因为您的示例中的内容看起来不太像 SqlServer),但是您需要澄清那是什么,以防有人知道,或者参考其文档。
与 VPN 的连接通常由操作系统或第三方软件(例如 Cisco VPN 客户端)建立,因此对于连接到数据库的软件来说是完全透明的。如果您希望能够在数据库连接之前以编程方式建立 VPN 连接,那就完全是另一回事了。
There's no, standard, way to define VPN connection settings as part of your connection string. There may be a way with the specific database provider you're using (as what you have in your sample doesn't look much like SqlServer), but you'd need to either clarify what that is incase someone knows, or refer to the documentation for it.
The connection to a VPN is normally establised either by the Operating System or by a 3rd party piece of software such as the Cisco VPN Client and thus is entirely transparent to the software that's connecting to the database. If you want to be able to establish the VPN connection prior to the database connection, programatically, that's a different matter entirely.