SQL 2008 Linked Server Connection - sql

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?

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.

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.

Related

Access another SQL Server through stored procedure

I want to access another SQL Server to import and update data of that server's database through a stored procedure.
For that I created linked server using sp_addlinkedserver.
EXEC sp_addlinkedserver
#server = N'LINKEDSERVER'
,#srvproduct=N''
,#provider=N'SQLOLEDB'
,#datasrc=N'[DB-Instance.cuprxxxlj.ap-xxxxxxx-x.rds.amazonaws.com]';
Then try to access by SQL query
SELECT *
FROM [LINKEDSERVER].[DATABASE].[dbo].[TABLE]
And getting errors like
OLE DB provider "SQLNCLI11" for linked server "LINKEDSERVER" returned message "Login timeout expired".
OLE DB provider "SQLNCLI11" for linked server "LINKEDSERVER" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].
I had created database instance on amazon server and another is also on the amazon server and both are publicly accessible but don't know why I'm getting Server is not found or not accessible. Am I missing any server site setting or something else?
Please guide me if I am going in wrong direction.
I found the answer. The problem was an instance, I had created "Amazon RDS for SQL Server" which is currently not supporting to "Linked servers".
So I create a new AWS EC2 instance for Windows Server 2012 R2 and then I create Linked servers in it and tried to assess remotely. Now its working fine as I wanted.
Here is detailed document to Running SQL Server Linked Servers on AWS
Thanks.
Maybe try changing the timeout settings?
sp_configure 'remote query timeout', 0
go
reconfigure with override
go
This article explains in detail how to link one AWS Sql Server to another (https://aws.amazon.com/blogs/apn/running-sql-server-linked-servers-on-aws/). I am not certain what is wrong in your case, but this has a lot of steps that I do not see in your description.
And the one thing that does jump out at me is that you haven't configured any login security/access control. So unless the target server is open to the world, I would guess that you have to add that as a minimum.

Creating a Link Server From SQL 2005 to Azure

I have a SQL Server 2005. I am trying to create a linked server to Azure SQL.
I set it up and tested the connection says it succeeded. However running any queries against it yields this
Enumerate columns failed for LinkedServer 'EBPCLOUD'. (Microsoft.SqlServer.Smo)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot obtain the schema rowset "DBSCHEMA_COLUMNS" for OLE DB provider "SQL Server" for linked server "(null)". The provider supports the interface, but returns a failure code when it is used. (Microsoft SQL Server, Error: 7311)
The exact same queries work on a different box, albeit with a newer version of SQL Server.
SQL Server 2005 will not connect to Azure, 2008 R2 or higher required.

problem in connecting studio management to sql server

I had installed SQL Server 2008, but faced some complications with that. I then installed SQL Server 2005, and now installed SQL Server Management Studio for SQL Server 2005 successfully.
I am not able to connnect to the server name it suggests.
TITLE: Connect to Server
Cannot connect to POONAM-C586A95C\SQLEXPRESS.
ADDITIONAL INFORMATION:
This version of Microsoft SQL Server Management Studio Express can only be used to connect to SQL Server 2000 and SQL Server 2005 servers. (Microsoft.SqlServer.Express.ConnectionDlg)
It doesn't show any other option of SQL Server name, though I changed the name as I remembered but for no good.
How can this be solved?
It sounds as if you're trying to connect to the 2008 instance with the 2005 SSMS. It's not clear whether you un-installed the 2008 instance.
Suggest installing the SQL Server 2008 SSMS.
Confirm/modify as needed that you're running the SQL Server instance that you require. This will show you which instances are available.
I would also check to make sure that you're connecting to the correct port. I'm come across a similar error before and the solution was to specify the port to connect to, i.e.
compname\instancename,portnum

Linked server issue while migrating shards from SQL Server 2005 to 2008 Enterprise R1

I am facing a strange problem during data migration. We "restored" data from 3 shards(on diff SQL Server 2005 machines) to single SQL Server 2008. We have single 2008 server now but the shards are unchanged from 2005.
Now I am trying to exec a SP on Master but I get the following error
Creating SP
OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
Msg 53, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [53].
All shards are on SQL Server. We are not using SQLNCLI10 provider. But it's strange to see this error.
My SP use some dynamically created distributed queries in SP.
eg. Shard01.dbo.Update.....
What could possible go wrong.
Solved the problem.
My SP was using a view which was moved restored from 2005 to 2008. 2008 has different shards configurations and SQLNCLI10 was used for OPENROWSET in 2005 but not in 2008 as all the DBs were on same server.
Redefining the view solved the issue.

Sql Server 2000 trigger that references a Sql Server 2008 database fails

We have a Sql Server 2000 database application that needs to update our applications Sql Server 2008 database when certain tables are changed. For this, we use a trigger on the Sql 2000 server that fires a stored procedure on our Sql 2008 server. When trying it from SMSS, I get this message:
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
Our application used to use a Sql Server 2005 database, but we upgraded servers this weekend. The linked server objects have the same configuration as on the old server. Here is my DTC configuration. Is there anything else that could go wrong?
dtc configuration http://yourcls.com/dtc-configuration.png
Google came up with this knowledge base article for me. From your screenshot, it looks like you've got DTC configured right (though I'm skimming, definitely double check it). Have you checked your firewall settings?
It turns out the same DTC security configuration window on our Sql 2000 server did not have any network DTC access enabled. This apparently worked just fine with our old server, but when we upgraded to Server 2008 and Sql Server 2008, this needed to be enabled on BOTH servers. It is a mystery.