Thursday, June 16, 2011

A Short Missive Concerning SQL Server, Named Instances, and JDBC

Since this seems to come up with some regularity on mailing lists and I happen to be in the midst of a massive SQL Server migration (lucky me) at the moment, I figured I'd set the record straight on this topic once and for all.

Named instances in SQL Server are not magic. Like everything else on servers, they run on a port. This named instance nonsense is simply Microsoft's way to get around expecting people to use a port number. (Because as we all know, having to deal with numbered ports is probably the biggest headache anyone in IT has to deal with. Yes, I'm being sarcastic.)

Anyway, even though the MS tools would like you to think this is all magic, not only do named instances run on a port, you actually pay a penalty by not referring to the port directly in your connection strings.

Why? Because again, there is no magic in IT, and the named instance doesn't mean squat to anything but SQL Server itself. So if you give SQL Server a named instance when trying to connect, there's an additional round trip to the server so SQL Server can translate that named instance you're asking for into a port number and return that to the thing connecting to it, at which point the connection is established using the port number. MS says so themselves here if you don't want to take my word for it.

Hope that settles it. Use the port numbers and forget about all this named instance voodoo, because that's all it is. Voodoo.

No comments: