SqlServer Connection Problems With Mono

If, like me, you use virtual machines and try to connect from Mono to SqlServer you might run into some problems. The top things I’ve learned to check are:

  1. Mono doesn’t support SqlServer 2000 below SP3 – this is relatively well documented this Mono page but still is hard to detect since the error message doesn’t give any clue about the problem.
  2. If you’re using some complex networking schemes, like bridged networks, beware of a Mono bug on Dns.GetHostEntry. Unlike Microsoft implementation, Mono ignores the IP you provide and tries to resolve the machine IP by itself. In some cases, specially when using virtual machines, the IP returned will be breaking hipotesis of connecting to the correct machine. I’ve tried to follow Microsoft implementation and created a bug report and patch.
  3. If you’re using slow networks or slow virtual machines (resulting in slow network) you might also want to beware of yet another Mono bug. When connecting to a SqlServer using instance names (SERVER\INSTANCE) Mono needs to connect to Microsoft SqlServer Monitor Browser to get the correct port for that instance. Current Mono implementation waits 100ms to the response, which is very low on slow network/virtual machines. I’ve implemented a patch which increases this time limit to 15 seconds, giving plenty of time to network delays and even some server restart case scenarios which could be exposed in real-world application scenarios. The bug report and patch.

I’ve posted both bugs/patches on bugzilla and mailed them to the mailing list but noone answered :( Hope this helps anyone in trouble.

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

2 Responses to “SqlServer Connection Problems With Mono”

  1. […] See the rest here: SqlServer Connection
    Problems With Mono […]

  2. Thank
    you for the Dns.GetHostEntry info! It have been a lot useful for me :)

Leave a Reply

For spam filtering purposes, please copy the number 7569 to the field below: