In addition to neat SQL support IntelliJ IDEA offers you a set of tools to connect to a database, browse and alter table data, run queries and manage schema structure.
1. Open the Database tool window
To access a database you have to configure a data source. To see the list of data sources or configure a new one you need the Database tool window. If this window is not visible use the button in the left bottom corner to open it.
2. Create a data source
To configure a data source, use the New button on the toolbar. You'll be asked you to choose a data source type from the list.
3. Download the driver
If you configure a data source for the first time, IntelliJ IDEA hasn't downloaded the driver yet. Just press the Download button and the IDE will do everything automatically.
4. Specify host, port and credentials
The driver is set, so you can specify the host, port, database and credentials for the data source.
As you'll see the IDE automatically composed the connection URL based on the settings. However you can always override it via the corresponding field.
You may also notice that the dialog has two checkboxes in the bottom: Read-only and Auto sync. As you might guess the Read-only checkbox protects the data source from any changes. This is especially useful if you work with a production database. The Auto sync checkbox prevents the IDE from automatic synchronizations with the database. This might be useful when the connection is not good or when the database has too many objects.
5. Test connection
To make sure the data source connection settings are correct, click the Test Connection button.
6. Select schemas
Now you can select schemas to show in list via the Scan for Tables column on the Schemas & Tables tab. Make also sure to select the corresponding schemas using Make Default column if you'd like to access its tables without a schema prefix.
When you are done with the data source setting click the OK button.
Once the data source is configured, you can work with it as through a full-featured database client: run queries, browse and alter table data, manage schema, etc.