TinyTDS: Server name not found in configuration files


I keep seeing this error, and I am unable to connect to the database on the remote server.

I am given a connection string to the database, that looks like the following:

data source=qsss.gar.de\SQL2012,3000;initial catalog=City;persist security info=True;user id=user_me;password=user_me##2009;

Now, I have created a database.yml file based on that connection string, like the following:

development:
    adapter:  'sqlserver'
    host:     'qsss.gar.de\SQL2012,3000'
    port:     1433
    database: 'City'
    username: 'user_me'
    password: 'user_me##2009'

And as I try and run the server, it always hits me with the Server name not found in configuration files error.

opts[:port] ||= 1433
      opts[:dataserver] = "#{opts[:host]}:#{opts[:port]}" if opts[:dataserver].to_s.empty?
      connect(opts) // ERROR AT THIS LINE
    end

    def tds_73?

Please try and help me figure what is the problem with this?

UPDATE:

I can connect to the server using SQLPro for MSSQL wizard, with exactly the same connection parameters:

picture

It works from the wizard, but not from code using TinyTDS!


Answers:


I was having the same problem and I was able to resolve it by changing the "host" parameter to "dataserver" in the config.yml file.

Also check if the server running the application is able to resolve the DNS name of the database server if it does not put the IP of the server.

I also use Microsoft SQL database and can only resolve the "TinyTds :: Error: Server name not found in configuration files" error after changing the above file.