1
votes

I'm trying to verify a connection through a firewall, and we are very limited in the access allowed. Ultimately, data will be loaded from an Access database on another server to our SQL Server database using an SSIS package. I can ping that source server from my computer and get a reply -- I want to put that in our SSIS package and see if the destination SQL Server can get a ping reponse.

Right now, the OLE DB source connection fails from both my computer and the server, ping works directly from my computer, and I don't know if it will work from the server or not. SSIS is the only thing I can put and run on the server, and it also what we plan on using for getting data from this other source.

Is there a fairly simple way to use a SSIS package to ping a specific address? I probably don't even need to know anything more than whether it fails or works.

I cannot use sys.sp_comdshell because that is turned off as part of our security configuration for our sql server. I cannot remote to the server and use ping directly.

1

1 Answers

1
votes

You could add a Script Task to your Control Flow with some code that does the ping for you. The System.Net.NetworkInformation namespace in .NET 2.0 and up contains a Ping class that can do the work for you. I suspect it might look something like this:

public void Main()
{
    using (Ping ping = new Ping())
    {
        try
        {
            PingReply reply = ping.Send(url, 100);
            if (reply.Status == IPStatus.Success)
            {
                Dts.TaskResult = (int)ScriptResults.Success;
            }
            else
            {
                Dts.TaskResult = (int)ScriptResults.Failure;
            }
        }
        catch
        {
            Dts.TaskResult = (int)ScriptResults.Failure;
        }
    }
}