Search code examples
ruby-on-railsrubytiny-tds

Do I need FreeTDS to use TinyTDS under Windows?


I'm trying to connect to SQL Express from a Rails app, and I've installed the TinyTDS gem. I keep getting an error:

--------------------
Unable to connect: Adaptive Server is unavailable or does not exist
--------------------

Everything I find on Google relates to FreeTDS. Do I need it in order to use TinyTDS on Windows? The TinyTDS github page says it requires it but it makes no mention of Windows.

Do I need drivers or something else? I already isntalled the 'activerecord-sqlserver-adapter' gem.

If I do need FreeTDS, where do I get it?


Solution

  • There is a binary version of Tiny_TDS that is installed on Windows when you install this gem. This includes FreeTDS, so there's no need to install it separately. Only time you have to worry about FreeTDS on Windows is if you want to work with SQL Database on Windows Azure, which requires you to manually build FreeTDS.

    There's a couple things that could go wrong that might cause a connection failure:

    • SQL Express doesn't install a default instance, but instead installs a 'sqlexpress' instance. Maybe try connecting to 'servername\sqlexpress'.
    • SQL Express may not allow network connections. If you're trying this over the network you may have to enable networking.
    • TCP/IP and named pipes may not be enabled. I think Tiny_TDS uses TCP/IP.
    • SQL Express might be using a dynamic port rather than the expected 1433, so maybe check ports.

    Here's an article that might help: http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx.