Showing posts with label Connection. Show all posts
Showing posts with label Connection. Show all posts

Thursday, November 01, 2012

Script to check SQL Server Linked Server Status

 

It leverages on the system stored procedure sys.sp_testlinkedserver


SET NOCOUNT ON;
DECLARE @LinkName NVARCHAR (128), @retval INT, @msg varchar(300)
IF (SELECT COUNT (srvname) FROM sys.sysservers WHERE srvname <> @@SERVERNAME) = 0 RETURN

DECLARE srvname INSENSITIVE CURSOR FOR
        (SELECT srvname FROM sys.sysservers WHERE srvname <> @@SERVERNAME) FOR READ ONLY
OPEN srvname
    FETCH NEXT FROM srvname INTO @LinkName
WHILE @@FETCH_STATUS = 0
BEGIN
    BEGIN TRY
        EXEC @retval = sys.sp_testlinkedserver @LinkName
    END TRY
   
    BEGIN CATCH
        IF @LinkName IS NULL RETURN
        SET @retval = SIGN(@@ERROR)
        IF @retval <> 0
        BEGIN
          SET @msg = 'Unable to connect to the Linked server : ' + @LinkName
          RAISERROR (@msg, 16, 2 )
        END
    END CATCH
    FETCH NEXT FROM srvname INTO @LinkName
   
END   
   
CLOSE srvname
DEALLOCATE srvname

Thursday, November 19, 2009

Testing a Connection from Client to SQL Server using UDL

A connection from client to SQL Server can easily be checked with the help of a .udl file. This is also helpful for building a connection string.

Step 1 - Create a .udl file
Create a text file and name it for example test.udl
Double click on test.udl to open the connection dialog.

Step 2 - Choose the type of connection
Go to the first tab “Provider”
Choose “Microsoft OLE DB Provider for SQL Server” or any other provider according to your needs.

Step 3 - Set up connection properties
Go to the second tab “Connection”, choose the server, enter username/password and choose a database from the drop down list.

Step 4 - Connection String
Once you click on “OK” a connection string based on your connection settings is written to test.udl. After you open test.udl you will find a connection string like this.

[oledb]; Everything after this line is an OLE DB initstringProvider=SQLOLEDB.1;Password=wrf%32g;Persist Security Info=True;User ID=siva;Initial Catalog=msdb;Data Source=SQLTEST

Saturday, April 05, 2008

Connetion to SSIS from client computer failed



Consider the following scenario. A server is running Microsoft SQL Server 2005 Integration Services (SSIS). From a client computer, you use SQL Server Management Studio to connect to Integration Services on the server. To connect to Integration Services on the server, you use a user account that is not a member of the Administrators group on the server. In this scenario, you receive the following error message:

Cannot connect to SSISServer
Additional information: Failed to retrieve data for this request (Microsoft.SqlServer.SmoEnum)
Connect to SSIS Service on machine "SSISServer" failed: Access is denied.

Refer solution at
http://support.microsoft.com/kb/940232/en-us