Visual Studio for Mac; SQL Server Express LocalDB. LocalDB is a lightweight version of the SQL Server Express database engine that's targeted for program development. LocalDB starts on demand and runs in user mode, so there's no complex configuration. By default, LocalDB database creates.mdf files in the C:/Users/ directory.
- Sql Server Express Tutorials
- Sql Management Studio For Mac
- Sql Server Express For Mac
- Sql Server Express 2016 For Mac
- Sql Server Express 2016 Mac Os X
Never did I think that I'd be able to run SQL Server on my Mac. My, how times have changed. For the first time, SQL Server 2017 allows users to install the product on Linux. This opens the doors for working with fully-featured SQL Server database engines on MacOS through freely distributable Docker. SQL Server 2019 makes it easier to manage a big data environment. It provides key elements of a data lake—Hadoop Distributed File System (HDFS), Spark, and analytics tools—deeply integrated with SQL Server and fully supported by Microsoft. Easily deploy using.
In this post I would like to tell about a brief insight of benefits what Docker can provide to you as a .NET stack developer working with SQL Server. Maybe the main focus and excitement this time will be about the new opportunities in local development on Mac OS, nevertheless the good things what Docker can bring to you are more than just that.
A short background
Why Mac OS?
I'm a web developer & CI/CD process administrator in my everyday work in Geta. I have Mac OS as my host OS for many years now and I really enjoy the benefits what I get using devices in so called 'Mac ecosystem'. Won't go in more details about it this time but that is why I'm writing about Docker in Mac OS.
Why SQL Server?
Our company's core business is to produce web applications & services built on .NET platform and obviously SQL Server is most common database engine choice in this context because it fits well with .NET applications. This means that pretty much every developer in our company has to run local SQL Server instance for local development purposes on their computers. And obviously there haven't been easy solutions to run SQL Server natively on Mac OS, which requires me to run it on Windows hosted on Parallels Desktop VM, which in turn makes me sacrifice some host OS resources. As I mentioned, I take it in favor of having some other benefits of working on Mac OS. :)
Why Docker?
Docker / containers / microservices has been a buzz words to me (from sessions in conferences, different blog posts, buddy in the company who have had hands-on experience with Docker - Klavs Prieditis) for a several years, but I never managed to discover these things more. And then few weeks ago somewhere on the Internet :) I ran into this MSDN post about running SQL Server 2017 container with Docker which reminded me that would be nice to test these things. Finally the last thing which nailed it all was a message from another workmate in Geta Valdis Iljuconoks about the new lightweight SQL tool by Microsoft which can be run on Mac OS.
So these are basically the reasons why I felt it was right time for me to try all these pieces stiching together and to see if I could get more freedom of Windows & Parallels Desktop. Turned out it was easy to set up everything -> it is easy to use -> it performs much faster than on Parallels VM -> I'm happy -> I want to tell about this to others! :)
Problem
As I mentioned before I rely on Parallels Desktop VM to run SQL Server local instance. That means I have to start my Windows VM every time I need to access some local database which takes some time obviously as well as running software on VM is not as resource-efficient as running similar software on native OS.
Besides that SQL Server Management Studio (which I used before to connect to my local SQL databases) alone is a rather heavy piece of software, which is often more than you need to do a basic tasks with SQL Server e.g. run basic table queries, create new users, grant permissions etc.
Solution
1. Install Docker engine (Docker for Mac in my case)
That's a rather straightforward installation process, just follow the installation instructions on Docker site. When you have completed installation you must have Docker whale icon visible in Mac OS menu bar.
You can verify that Docker CLI is also successfully installed by running
docker version
command.2. Pull & Run SQL Server Docker container image
Again, this is also very simple (even without any previous Docker knowledge) if you follow the MSDN post.
- Pull the SQL Server image from Docker Hub.I was totally fine with the latest SQL version so I went with that.Btw, really sweet progress bar for Docker CLI. :)
- Run container image on your Docker engine.I did some parameter value adjustments in the
docker run
comand (e.g. container name, SQL password) and also added shared folder mapping option my from host OS. It's good to have shared folder mapped when you would like to transfer some files into docker container. In my case I realized that I need it for copying db backup file and later restoring a db from it.
3. Connect to a Docker SQL Server from your preferred SQL tool
SQL Operations Studio
As I wrote before one of the main reasons of my excitement about this all was release of SQL Operations Studio for Mac OS which is a free SQL Server tool that runs on Mac OS. I find it very good for doing basic everyday tasks (from web developer perspective) because of simplicity and having GUI.
Before SQL Operations Studio I was sometimes using also mssql extension for VS Code which also runs on Mac OS but in comparison lacks nicer GUI for switching databases and SQL servers, restoring databases. Nevertheless it can be handy if you don't have to work with SQL Server often and not with many different servers and databases. I feel like SQL Operations Studio is a nice alternative for me between comprehensive SQL Server Management Studio and VS Code in terms of simplicity and functionality features.
So now you can connect to the local SQL Server instance running on Docker by specifying a server name (localhost) and a port number (1401) what you specified in the
docker run
command previously.Woohoo! You are finally connected to SQL Server instance running on Mac Docker container and using SQL tool running natively on Mac OS too. :)
You can now either create new db from script or restore it by first copying backup file into mapped Docker folder and then selecting the db backup file in Restore dialog of SQL Operations Studio.
SQL Server Command Line Tools
Just wanted to note that there is also SQL Server Command Line Tools for Mac which is another relatively new SQL tool from Microsoft which is now available for Mac OS (in preview version though). It is yet another evidence that .NET stack developers are slowly 'set free' of having to use Windows.
sqlcmd can be installed via the Homebrew package manager which (as many Mac users probably already know) is really handy tool for easy beer brewing installation of various applications from Terminal.
At first link the sqlcmd git repository with
brew tap
command.Then simply install the software with
brew install
.Now you can connect to your SQL Server with sqlcmd command line utility from Mac OS Terminal.
And even run a SQL query! :)
Summary
To wrap this up I could say that with rather small effort it is possible to set up OS-independent SQL Server instance, which can be easily stopped, transferred to other environment, ran together with other versions / instances of SQL server etc. Docker provides a lot of isolation and flexibility and makes life much easier for many developers (not only for those who are on Mac OS) epsecially when there are sufficient SQL tools which are free and can run on their OS.
Developer
Andris Sarbantovics
- E-mail: [email protected]
- Phone:
Please enable JavaScript to view the comments powered by Disqus.comments powered by Disqus
The OpenLink ODBC Driver for SQL Server (Express Edition is adistributed as a Disk Image (DMG) file. Simply double click on thedisk image 'mul6esql.dmg' to extract the installer mpkg file:
Figure 10.1. SQLserverDMG.png
Double-click on the mpkg file to run the installer and followingthe on screen instriuction as indicated below to complete theinstallation:
Sql Server Express Tutorials
Figure 10.2. SQLpackage.png
Installer Welcome Dialog for the OpenLink ODBC Driver for SQLServer (Express Edition):
![For For](/uploads/1/3/4/1/134121313/247767484.gif)
Figure 10.3. SQLinstall1.png
Please review the readme file for installation requirements andknown issues:
Figure 10.4. SQLinstall3.png
Please read the software license agreement before continuingyour installation:
Figure 10.5. SQLinstall4.png
Figure 10.6. SQLinstall6.png
Sql Management Studio For Mac
Select destination volume for driver installation:
Figure 10.7. SQLinstall7.png
Choose to perform a custom or default installation of thedriver:
Sql Server Express For Mac
Figure 10.8. SQLinstall8.png
If you chose the custom option select which of the componentsbelow are to be installed:
Figure 10.9. SQLinstall10.png
The Software must be installed as a user with Administrativeprivileges on the machine:
Figure 10.10. SQLinstall12.png
After the driver has been installed you will be prompted for alicense file. If a license file already exists on the machine thenselect the 'use exisiting file' option. A trial (try) or full (buy)license can be obtain by selecting the 'try and buy' option whichloads our online try-and-buy web page:
Figure 10.11. SQLinstall14.png
To obtain the trial license you must be a registered user on theOpenLink Web site and login with the username (e-mail address) andpassword for that user. Click on the 'Shop' link to visit ouronline shop cart to purchases a full license if required:
Figure 10.12. SQLinstall15.png
Click on the 'download license' button to obtain the licensefile immediately and save to your desktop. Alternatively an autoe-mail will be sent to the registered users e-mail address with alink to their OpenLink Data Space (ODS) where all trial and fulllicense files will be stored in the Briefcase for download at alater date.
Figure 10.13. SQLinstall16.png
Vizio for mac. Select the license file to be used for the installation:
Trend micro for mac. Figure 10.14. SQLinstall18.png
Installation is complete:
Sql Server Express 2016 For Mac
Figure 10.15. SQLinstall19.png