SQL 2008 链接服务器连接
SQL Server 2008 上的链接服务器连接是否在 SQL Server 的连接之间共享?我想知道这一点,因为我有一个带有链接 Sybase 服务器的 SQL Server 2008。如果我打开 Management Studio 并连接到 SQL Server 并执行以下命令
exec('select id into #tempTable from test') AT LINKEDSERVER
,然后在 Management Studio 中打开另一个窗口并再次执行该语句,我会得到一个表已经存在。如果我通过代码执行它,然后通过 Management Studio 尝试它,似乎也会发生同样的事情。
链接服务器连接是否在 SQL Server 的不同连接之间共享,或者是否发生其他情况?
Does a linked server connection on SQL Server 2008 get shared between connections to the SQL Server? I am wondering this because I have a SQL Server 2008 with a linked Sybase server. If I open up Management Studio and connect to the SQL Server and execute the following
exec('select id into #tempTable from test') AT LINKEDSERVER
And then open up another window in Management Studio and execute the statement again I get a table already exists. The same things also seems to be happening if I execute it through code and then try it through Management Studio.
Is the linked server connection being shared between different connections to the SQL Server or is something else going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我承认我使用 Sybase 的经验非常有限,但是它是否使用 OLE DB 提供程序作为链接服务器?如果是这样,那么您应该获得连接池,因为 OLE DB 提供了连接池。
I confess my experience with Sybase is pretty limited, but does it use the OLE DB provider for the linked server? If so, yes you should be getting connection pooling as OLE DB provides connection pooling.
看来这是一个连接池问题。这并不是说链接服务器和 SQL Server 之间的连接被重用,而是因为连接池的原因,到 SQL Server 的连接被重用了。
It appears that this was a connection pooling issue. It wasn't that the connection between the linked server and SQL Server was getting reused, it was that the connections to the SQL Server were getting reused because of connection pooling.