Connecting to MS SQL Server from macOS / Mac OS X 1. The SQL Server database should be configured to accept TCP/IP connections. Many SQL Server installations are set up to only allow shared memory. If the user connecting to the database does not have a valid user id and password for the. Microsoft’s recent Connect(); event included a lot of interesting announcements. The one that really got my attention was SQL Server for Linux.My first question, of course: Can I run this on my Mac?
TablePlus provides a native MS SQL Server client on Mac that provides GUI tools with an intuitive interface to help you create, query, edit and save your Microsoft SQL Server databases in a very fast and secure way. Native Build for high performance TablePlus was built native so it takes advantage of some native macos element to optimize for the highest performance. Everything from starting up, executing queries to browsing data is so smooth. It feels almost instantly.
Easy to use Microsoft SQL Server Client At a glance, TablePlus has a well-designed UI that makes it very easy to adapt. New users don’t need to spend a lot of time learning how ot use the app. Connect to your Microsoft SQL Server database in a fast and secure way.
It automatically establishes the SSH tunnel to the correct port and logs you in seamlessly. It includes some best practices for security to protect your database such as its own libssh. Easy to use Microsoft SQL Server database editor TablePlus provides a Table GUI Tool to help you work with Data Table easier, including creating, editing, inserting, and deleting table data in a spreadsheet format. Edit database structure easier with a spreadsheet format. You can easily browse, create and edit objects in your Microsoft SQL Server such as views, triggers, indexes, functions, and procedures Easy to work with SQL query Writing query is more efficient with code completion feature, along with some of the best practices for SQL editor: Beautify SQL, Highlight Syntax, Split Results into Tabs, Split pane Horizontally that are all included in TablePlus. Every function in TablePlus is assigned to a shortcut key, which later you can customize, makes it quite handy to work with. For example, to use the filter, simple press cmd + F, execute a query with cmd + Enter.
I recently had to set up a MS SQL database on my Mac for a client project, if you ever have to do this here is a mini tutorial. In this post I am using VMWare Fusion for virtualisation, but you could use something else and the instructions should be mostly portable. Get a Windows VM Go to and download a VM (Virtual Machine) for your Mac. I will be using Windows 7 (the version of IE doesn't matter).
![Sql Sql](/uploads/1/2/5/6/125637752/878986294.png)
Install the virtual machine and log in. Get MS SQL Express with tools As you download the Windows VM you can also download the free version or MS SQL. At the time of writing the tinytds gem - the gem needed to access MS SQL - only supports MS SQL up to version 2012. So version 2014 won't work. Go to and download MS SQL Express 2012, make sure to get the version with tools (named something like ENU x86 SQLEXPRWT x86ENU.exe).
Install MS SQL Express If you downloaded MS SQL Express on your Mac, you will need to make it accessible to your Windows VM. If you are using Fusion you can simply drag and drop the installer to Windows. Run the installer and just install the default components. Accept the defaults in all other screens. Create a DB for testing In Windows, open SQL Server Management Studio.
Connect using the provided defaults, then:. Right click on Databases. Click on New Database.
Add a name e.g. Test. Click OK Enable SQL Authentication Still in SQL Server Management Studio:. Right click on the root of the tree e.g. IE11WIN7 SQEXPRESS. Select Properties.
Select Security. Enable SQL Server and Windows Authentication mode. Click OK Create a database user In Management Studio:. Click on Security on the tree. Right click on Logins. Select New Login.
Add a use e.g. Dbuser. Select SQL Server authentication. Add a password Set user mappings In the same screen:.
Click on User Mapping. Check the previously created DB e.g. Test. Click the.
Button on the right. In the pop up window, select Browse.
Check dbo and OK. Select OK again.
Select dbowner on the bottom. Finally click OK You can then close Management Studio. Enable TCP in Express In Windows, open SQL Server Configuration Manager.
Then:. Click on SQL Server Network Configuration. Click on Protocols for SQLEXPRESS. Double click on TCP/IP on the right. Change Enabled to Yes. Click on IP Addresses.
Scroll down all the way to IPAll. Set the TCP Port e.g. 1433.
Click OK Restart SQL (in the same window):. Click on SQL Server Services. Right click on SQL Server on the right and select Restart We can now close SQL Server Configuration Manager. Disable the Windows Firewall In Windows:.
![Ms Sql Server Mac Ms Sql Server Mac](/uploads/1/2/5/6/125637752/972179556.png)
Go to the Control Panel. Search for firewall and open the Windows Firewall settings. Click on Turn Windows Firewall on or off on the left. On the Home network settings, click on Turn off Windows Firewall. Click OK and close the control panel Find the IP address for the VM In Windows:. Click on the network icon on the bottom bar.
Click on Open Network and Sharing Center. Click on the link on Connections e.g. Local Area Connection. Click on Details.
Take note of the IPv4 Address e.g. 192.168.0.11 in my case, this is the IP our VM is running on Set network location to home In Windows:. Open the Network and Sharing Center as in the previous step.
Click on the link under Network if it says 'Public network'. Click on Home network in the pop up window. Click Next several times and then Finish The Network should be set to 'Home network' Test the connection from the Mac terminal In the mac terminal test the connection to the Windows VM: ping 192.168.0.11 Note that the IP address will most likely be different on your machine.
This should give you a successful ping. If you get a timeout double check the network settings and firewall in Windows.
Test the connection to MS SQL If you have an application that can connect to MS SQL on the Mac, I recommend testing the connection from there first before going to Rails. I am using Navicat in my case.
Otherwise just skip this step. In Navicat:. Create a new connection for MS SQL. Set the IP Address to your VM IP e.g. 192.168.0.11. Set the port as set previously e.g. 1433.
Set Initial Database to the DB created previously e.g. Test. Set User Name and Password as created previously. Test the connection Install freetds In order to connect to MS SQL, we need to install the necessary libraries in our Mac. Install freetds using homebrew, in the Mac terminal: brew update brew install freetds Add the tinytds gem to your project In your Gemfile: gem 'tinytds', ' 0.6' Then: bundle Set up the connection in Rails In your database.yml, add / modify an entry for using the MS SQL db: mssql: adapter: sqlserver host: 192.168.0.11 port: 1433 database: Test username: dbuser password: 123456 pool: 5 timeout: 5000 Take care to set the values as set previously i.e. Host, port, username and password.
When this is done, your Rails application should now be able to connect to the MS SQL Express server running on the VM.