Microsoft SQL Server LocalDB
Enable the Database tools and SQL plugin
This functionality relies on the Database tools and SQL plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features aren't available, make sure that you didn't disable the plugin.
Press Ctrl+Alt+S to open the IDE settings and select.
Open the Installed tab, find the Database tools and SQL plugin, and select the checkbox next to the plugin name.
Step 1. Check and create a LocalDB instance
To connect to your LocalDB instance with IntelliJ IDEA, check if your LocalDB instance is ready for a connection. To do that, locate SqllocalDB.exe and run the following command in a command prompt:
You will see a list of available LocalDB instances on the server.SqllocalDB.exe i
Next, create a LocalDB instance. To create an instance, run the following command:SqlLocalDB create "DEVELOPMENT" 15.0 -s
This command creates an instance of LocalDB named
DEVELOPMENTby using SQL Server 2017 binaries and starts the instance. If you omit
15.0, the version number defaults to the version of the SqlLocalDB utility.
To check an instance state, run this command.SqllocalDB.exe i MSSQLLocalDB
Currently, the instance is running (see the
Statefield). If you have the
Stoppedstate, start the instance by running the following command in the terminal.SqllocalDB.exe s MSSQLLocalDB
Step 2. Create the LocalDB connection
In the Database tool window ( ) , click the Data Source Properties icon .
From the Driver list, select Microsoft SQL Server LocalDB.
Check if there is a Download missing driver files link at the bottom of the data source settings area. As you click this link, IntelliJ IDEA downloads drivers that are required to interact with a database. The IDE does not include bundled drivers in order to have a smaller size of the installation package and to keep driver versions up-to-date for each IDE version.
You can specify your drivers for the data source if you do not want to download the provided drivers. For more information about creating a database connection with your driver, see Add a user driver to an existing connection.
From the Instance list, select the instance to connect to (for example,
From the Authentication list, select the authentication type:
User & Password: connect by using a username and a password.
Windows credentials: connect by using your Windows domain creadentials. Requires to run IntelliJ IDEA on Windows in the same domain as the Microsoft SQL Server database. Works as the Single-Sign On (SSO).
Kerberos: connecting by using Kerberos authentication. Requires a Kerberos server and authentication with
No auth: connect without authentication.
Domain credentials: connect by using a domain, a username, and a password.
To ensure that the connection to the data source is successful, click the Test Connection link.
(Optional) If you are connecting to a data source that contains a lot of databases and schemas, in the Schemas tab, select the schemas that you need to work with.
Click OK to create the data source.