Server String is null or empty

Jul 16, 2014 at 8:52 PM
I have an SSIS (SQL Server Integration Services) package that is c# based. I am trying to connect to a MySQL server using the SSH Renci library. Here is what I am trying:

using Renci.SshNet.Common;
using Renci.SshNet;

SshClient client;

client = new SshClient("", 3306, "MyName", "MyPassword");

I get an error: Server string is null or empty. Below is the full message.

I have three hairs left on my head and would like to salvage the remaining strands. Any help is greatly appreciated!

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Server string is null or empty.
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()
at ST_4cdf908771f54364870e08c182e0ce4d.csproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Jul 17, 2014 at 8:23 PM

I use both MySQL and SQL Server, but never the migration tool SSIS... But I have written lots of code against these databases that connect directly on 3306, and it isn't SSH. It's just plain TCP (and some UDP uses) with their clients, or a more universal DBI. In Visual Studio, I use SMO (Server Management Objects), and I can roll my own anything with that...

Check out here: to get started with connecting, and note that SSIS seems to come with a few tools (on the command line, and probably libraries) that connect for you. Odds are, that is what you are trying to do in the code above with the library you mentioned.

SSH is applied on a server/host as a dedicated daemon (or 'service' in windows parlance) that sits on (default) port 22. It is not associated with any programs, but rather creates a 'tunnel' between the calling client and the connected server that makes the data transferred harder to decode, but also more importantly facilitates the use of security options like certificates.

In addition, SSH is what we call in UNIX/Linux circles a 'terminal program', or 'shell'. This means that once that connection I talked about is made, the software on both sides sees that connection as just a command line waiting for you or a program of your choosing to type something in and hit Enter. SSH is also a protocol, meaning it is just a language that 2 computers can talk. What you and the target host say to each other is translated into SSH-speak as it travels between you, but to each other it looks like a DOS/Bash shell, in that it is in cleartext.

Bottom Line: If you are not using SSH, then you don't need SSH, and SSH will not work for you.

Some info to help you understand more:

SQL Server Integration Services on Wikipedia
SSIS Top Level Page on TechNet
[Connecting to SSIS on TechNet](Connect to a Remote Integration Services Server (SSIS Service))

The previous links will get you connected to SSIS, the following links will get you up to speed on not just when to use SSH (and eventually you will), but also how.

Secure Shell on Wikipedia
SSH2 on Wikipedia
Tunneling with SSH on Wikipedia
SSH2 RFCs and nitty-gritty details on SnailBook
Secure Shell Protocol on Cisco
...and finally...
The excellent An Overview of the Secure Shell (SSH) PDF by VanDyke Software

All the best!

Marked as answer by drieseng on 11/8/2014 at 11:56 AM