Connect to SQL Server Express LocalDB
Step 1. Check the LocalDB instance
You can easily connect to your LocalDB instance with PyCharm. And as a first step, check if your LocalDB instance is ready for a connection. Locate SqllocalDB.exe and run the
SqllocalDB.exe i command in a terminal. You will see a list of available LocalDB instances on the server.
To create an instance, run
SqlLocalDB create "DEVELOPMENT" 14.0 -s. This command creates an instance of LocalDB named
DEVELOPMENT by using SQL Server 2017 binaries and starts the instance. If you omit
14.0, the version number defaults to the version of the SqlLocalDB utility.
We want to connect to the
MSSQLLocalDB instance. First, we need to check its state by running
SqllocalDB.exe i MSSQLLocalDB command.
Currently, the instance is running (see the
State field). If you have the
Stopped state, start the instance by running
SqllocalDB.exe s MSSQLLocalDB in the terminal.
Step 2. Create the Microsoft SQL Server data source
The instance is ready, you can launch PyCharm.
In the Database tool window ( ), click the Add icon and select
Microsoft SQL Server.
Step 3. Configure the LocalDB connection
Select the connection type
From the Connection type list, select LocalDB.
Select the driver
From the Driver list, select Microsoft SQL Server (jTds).
Select the LocalDB instance
From the Instance list, select the instance to connect to (for example,
Step 4. Select your authentication type and test your connection
From the Authentication list, select the authentication type:
User & Password requires a username and a password.
Windows credentials requires you to run PyCharm on Windows in the same domain as the Microsoft SQL Server database. Works as the Single-Sign On (SSO).
Domain credentials requires a domain, a username, and a password.
For User & Password and Domain credentials, enter your access credentials. Click