Search code examples
sql-serversql-server-2008ubuntuodbcfreetds

Paramters Needed to access MS SQL Database from Ubuntu


So I've been working on this for a few hours now and have made no progress. I know this may be an easy/stupid question, so I apologize in advance for my extreme lack of knowledge here.

I have a MYSQL 5.7 database in which I am trying to push to a MS SQL 2008 database. The MYSQL database is local on my Ubuntu 16.04 machine. I have configured FreeTDS to try and do this.

The issue is the person only gave me these parameters which I believe are incomplete.

Server Address: database\SQLEXPRESS
User Name: DatabaseUser
Password: datapassword
Databasename: DBName

Don't I need an IP address/web address and a port to connect? It seems that the "string\SQLEXPRESS" format is not an actual server address (or may be for people who are on the servers network).

Additionally, since the MS SQL Sever is run on a windows machine, will I need my IP address to be white-listed, or does this depend on how the server was set up?


Solution

  • SQL Server addresses are specified via an IP address or hostname, followed by an (optional) instance name. The point of instance names are to differentiate between different instances of SQL Server on the same machine. Regular, non-Express versions of SQL Server don't have an instance name by default, so you should be able to just specify the server's IP or hostname in the address field:

    Server Address: 192.168.0.1
    

    SQL Server Express's instance does have a name by default, SQLEXPRESS. If you know you're connecting to a SQL Server Express instance, then most likely you're looking for

    Server Address: 192.168.0.1\SQLEXPRESS
    

    As far as connecting to the server, yes, the server needs to be reachable via TCP/IP from the client, so that presumably depends on your network setup.

    You also need to enable remote access to the server. This setting is exposed in Management Studio -> Connect to server -> Right click on server, Properties... -> Connections node -> Remote server connections -> Check "Allow remote connections to this server". You might have to do this from a SQLMS instance on the server.

    You also need to make sure that your preferred connection protocol (Shared Memory, Named Pipes, TCP/IP) is enabled. You can do this via Sql Server Configuration Manager, which should be installed on the server. Open it, then SQL Server Network Configuration Node -> Protocols for -> Enable or disable the protocols as desired.