-
Open the Data Source Properties dialog box by doing one of the following:
- Start creating a new DB data source.
- In the Data Sources tool window, select the desired data source and choose Data Source Properties in the context menu.
- Specify the name of the data source.
- Specify the scope in which the data source will be available in the Data Source Level drop-down list.
- To enable access to the data source only from the current project, select Project.
- To enable access to the data source from any project in your workspace, select Global.
-
In the JDBC Driver Files drop-down list on the Database tab of the Data Source Properties dialog box,
specify the library or archive with the class that implements
the JDBC driver
of the required type. Do one of the following:
-
If you already have a relevant library or archive downloaded,
click the Browse button
and select the library or archive in the Choose JDBC Driver Files dialog box that opens.
- To have IntelliJ IDEA download the JDBC driver sources, select the required JDBC driver from the drop-down list. The read-only list below displays the relevant archive detected among the specified sources. Click the link to have IntelliJ IDEA start downloading the detected archive.
Note
IntelliJ IDEA analyzes the archives and libraries and detects classes that implement drivers. Detected classes are available in the JDBC Driver Class drop-down list.
-
If you already have a relevant library or archive downloaded,
click the Browse button
- From the JDBC Driver Class drop-down list, select the relevant driver implementation class.
- In the Database URL text box on the Database tab of the Data Source Properties dialog box, type the URL address of the database.
- In the Username and Password text boxes, type your database access credentials.
-
To check that the specified settings ensure successful connection to the database, click the Test Connection button.
Warning
The database server should be running.
- Click the Refresh Tables button
.
Tip
If you do not need to access the entire database, specify the set of accessible tables.
- Open the Schemas & Tables tab of the Data Source Properties dialog box.
- Do one of the following:
- If the target database supports schemas
,
select the Scan for Tables check box next to the relevant schemas.
Tip
To have IntelliJ IDEA resolve the names of the tables accessed through a schema so you do not need to write their fully qualified names, select the Make Default check box next to the relevant schema.
- Specify the pattern of table names to retrieve the matching tables only.
- If the target database supports schemas
- Open the Console tab of the Data Source Properties dialog box.
- Specify the SQL dialect to be used by default. Based on this setting, IntelliJ IDEA provides you with code assistance in the Database Console tool window.
- Specify the run configuration to launch the Database Console tool window.
- In the Advanced tab of the Data Source Properties dialog box, update the contents of the Value text box next to the names of the relevant connection properties.
