IntelliJ IDEA 2018.2 Help

Data Sources and Drivers dialog

To access this dialog from the Database tool window: iconManageDataSources or icons general add svg on the toolbar


Overview

This dialog lets you manage your data sources and database drivers.

ijDBPostgreSQLConnectionSuccessful

Left-hand pane

This pane shows your data sources and drivers. When you select an item, its settings appear in the right-hand part of the dialog.

Use the toolbar icons, context menu commands and associated keyboard shortcuts to manage your data sources and drivers, and also to perform other, related tasks.

Item

Shortcut

Description

icons general add svgAlt+InsertUse this icon, command or shortcut to create a new data source or driver. Select:
  • Android SQLite to create a data source for an SQLite database located on an Android device or emulator. For this option to be available, there must be an Android application module in your project and/or an Android SDK has to be defined in IntelliJ IDEA.

    See Android SQLite data source settings.

  • The name of DBMS to create a DB data source associated with the corresponding DBMS. If you have created your own drivers, you can also select a driver to use it as the basis for creating the data source.

    See DB data source settings.

  • DDL Data Source to create a DDL data source.

    See DDL data source settings.

  • Database Driver to create a driver.

    See Driver settings.

icons general remove svg Remove

Delete

Use this icon, command or shortcut to remove the selected item or items from the list.

icons actions copy svgDuplicate

Ctrl+D

Use this icon, command or shortcut to create a copy of the selected data source or driver.

icons general settings svg Go to Driver

Ctrl+B

Use this icon, command or shortcut to view or edit the settings for the driver associated with the selected DB data source.

icon importCopyrightProfile Make Global or Move to Project

Use this icon or command to move the selected DB data source to the global or project level. Global data sources are available in all your projects.

Change Driver

If more than one driver is available for the selected DB data source, use this command to associate the data source with a different driver.

Reset Changes

Ctrl+Alt+Z

Use this command or shortcut to undo the changes made to the selected item.

Load Sources

For the selected DB data source or data sources, IntelliJ IDEA will load source code of database objects for the category of schemas that you select.

The alternative way of setting this option - for each data source individually - is by using Load sources for on the Options tab.

Show Driver Usages

Alt+F7

Use this command or shortcut to find the DB data sources that use the selected driver. The found data sources are shown in the Used By popup which lets you navigate to anyone of the found data sources.

icons actions back icons actions forward

Use these icons to switch between the items you've been workings with.

Android SQLite data source settings

Specify the settings for the SQLite database located on an Android device or emulator.

Item

Description

Name

Use this field to edit the name of the data source.

Device

Specify where the target database is located. This may be an Android device connected to your computer or a running Android device emulator.

If [none] is the only option in the list, connect the device to your computer or start the emulator. Unless you do that, you won't be able to configure the data source.

Package name

Specify the name of the application package the target database is associated with. For more information about application packages Android documentation. Select a package name suggested by IntelliJ IDEA or type its ID.

For the database to be accessible, the corresponding application must be built as debuggable and installed on the device or the emulator.

IntelliJ IDEA run configurations, by default, build Android applications in the debug mode. Alternatively, you can generate the APK in the debug mode.

Storage

Select:
  • Internal if the database is stored in the internal memory of the device or the emulator.

  • External if the database is stored in the external memory of the device or the emulator.

Database

If the database is stored in the internal memory, specify the database name. One of the names suggested by IntelliJ IDEA may do.

If the database is stored in the external memory, specify the database location relative to the memory root. This may be something like Android/data/<application_ID>/<database_name>.

Download

If the necessary SQLite driver files are missing, you can download them by clicking the Download link in the lower part of the dialog.

DB data source settings

General tab

Shown on this tab are mainly the database connection settings.

The user interface is adjustable: the set of available controls depends on which option is selected in the list to the right of the URL field.

Item

Description

File

If your database is a local file, specify the path to that file.

browseButton lets you select an existing database file.

icons general add svg lets you create a new database file.

Path

If your database is a local file or folder, specify the path to that file or folder.

browseButton lets you select the database file or folder.

Create database. Select this option to create a new database. (This option may be unavailable.)

Host

Specify the hostname (domain name) or the IP address of the computer on which the database is located. If the database is on your local computer, specify localhost or 127.0.0.1.

If you are using SSH, the database host must be accessible by the specified domain name or IP address from the computer on which the SSH proxy runs. See SSH/SSL tab.

Port

Specify the database port number.

Database

Specify the name of the target database or schema.

User

Specify the name of the database user (i.e. your database user account name).

Password

Specify the password for the database user.

Remember password

Select this checkbox if you want IntelliJ IDEA to remember the password. See Passwords.

URL

Shown in this field is the URL that IntelliJ IDEA will use to connect to the database. The user interface for specifying the URL is different depending on which option is selected in the list to the right:
  • URL only. This option, generally, is for editing the database connection URL directly.

    When you select this option, only the following fields are available: User, Password and URL.

    You should edit the URL right in the field. Your user name and password, if necessary, are specified in the corresponding fields, or within the URL in the format appropriate for the JDBC driver that you are using.

  • When using any other of the options (the options are DBMS-specific), IntelliJ IDEA forms the database connection URL automatically using the info in the fields above the URL field. In all such cases, normally, you don't need to edit the URL (though you can if you want).

Test Connection

Click this button to make sure that the database connection settings are correct and IntelliJ IDEA can communicate with the target database.

Driver

Click the <driver name> link to switch to the settings for the associated driver.

Read-only

Select this checkbox if you want to protect the data source from accidental data modifications.

As a result, you won't be able to modify the data in the Data editor.

Whether data modifications will be possible by means of the consoles depends on the DBMS: IntelliJ IDEA will try to set the database connection status to read-only. All the rest depends on the database driver, i.e. whether and to which extent the driver supports the read-only status.

Tx

The way transactions are committed: Auto or Manual. The selected option is used by default in the data editors and database consoles associated with the data source.

Auto sync

If this option is off, the view of the data source in the Database tool window is synchronized with the actual state of the database only when you perform the Synchronize command (icons actions refresh svg or Ctrl+Alt+Y).

If this option is on, the view of the data source is automatically updated:

  • When you change the data source settings. (Technically, when you click OK in the Data Sources and Drivers dialog.)

  • When you run DDL SQL statements in the database consoles associated with the data source.

Note that auto sync is performed for the overall database and, thus, may be time-consuming. So auto-synchronization is more suitable for "small" databases. If your database is "big", it’s recommended that you sync its state manually (e.g. Ctrl+Alt+Y), and only for the appropriate database parts such as separate tables.

SSH/SSL tab

If the target database should be accessed using SSH or SSL, select the corresponding checkbox and specify the associated settings.

To access a remote database using an SSH proxy, select Use SSH tunnel and configure the following settings:

Item

Description

Copy from

If there is already a data source for which the necessary SSH settings are specified, you can copy those settings from that data source.

Click the link and select the data source to copy the settings from.

Proxy host

Specify the hostname (domain name) or IP address of the SSH proxy server that you are using. The SSH proxy server host must be accessible by the specified hostname or IP address from your local computer.

Port

Specify the port on which your SSH proxy server accepts SSH connections. The port number 22 suggested by IntelliJ IDEA is the standard port used by SSH servers. Change this number if your SSH proxy server uses a different port.

Proxy user

Specify the name of the SSH proxy user.

Auth type

Specify the user authentication type used by your SSH proxy. Select:
  • Password for password-based authentication.

  • Key pair (Open SSH) for key-based authentication.

Proxy password

For password-based authentication: specify the password for the SSH proxy user.

See also, Remember password.

Private key file

For key-based authentication: specify the path to the file where the corresponding private key is stored. Type the path in the field, or click browseButton (Shift+Enter) and select the file in the dialog that opens.

Passphrase

For key-based authentication: specify the passphrase for the private key if the key is locked with the passphrase.

Remember password

Select this checkbox if you want IntelliJ IDEA to remember the password or the passphrase. See Passwords.

To use SSL encryption for communicating with the database, select Use SSL and configure the following settings. All the files specified in this section should be in PEM format. Which files are required depends on the SSL properties of your user account.

Item

Description

Copy from

If there is already a data source for which the necessary SSL settings are specified, you can copy those settings from that data source.

Click the link and select the data source to copy the settings from.

CA file

Specify the path to SSL Certificate Authority (CA) certificate file. If used, this must be the same certificate as used by the server.

Type the path in the field, or click browseButton (Shift+Enter) and select the file in the dialog that opens.

Client certificate file

Specify the path to your (client) public key certificate file.

Type the path in the field, or click browseButton (Shift+Enter) and select the file in the dialog that opens.

Client key file

Specify the path to your (client) private key file.

Type the path in the field, or click browseButton (Shift+Enter) and select the file in the dialog that opens.

Schemas tab

Select the databases and schemas to be shown in the Database tool window.

Item

Description

icons actions refresh svg

Refresh the list of the databases and schemas.

DBSchemasSearchField

Specify the text for filtering the list. Only the databases and schemas whose names contain the specified text will be shown.

Pattern

An alternative to selecting the databases and schemas by means of the checkboxes. *.* would mean all schemas in all databases. To get the info about the syntax to be used, place the cursor into the field and press Ctrl+Q.

Options tab

The settings on this tab relate to filtering database objects, loading source code, etc.

Item

Description

Object filter

You can limit the set of tables and other database objects shown in the Database tool window for each data source using the Filter menu in the toolbar.

The Filter menu

Alternatively, you can manually specify more granular filtering options using the Object filter field on the Options tab of the Data Sources and Drivers dialog (iconManageDataSources).

The Object Filter field in data source options

The following examples demonstrate the filter syntax:

  • f.*

    Show only objects whose names start with f.

  • table:[gh].*

    Show tables whose names start with g or h, and all other object types.

  • view:new_.*||routine:-[ps].*

    Show views whose names start with new_, routines whose names start with any letters except p or s, and all other object types.

Plan table

For Oracle: The name of the table that should be used to store the EXPLAIN PLAN output information.

Introspect using JDBC metadata

You may want to select this checkbox (if available) to try to fix the problems with retrieving the database structure information from your database (e.g. when the schemas existing in your database or the database objects below the schema level are not shown in the Database tool window).

This option defines which of the following alternative introspectors IntelliJ IDEA is using to retrieve the info about the database objects (DB metadata):

  • A native introspector (may be unavailable for certain DBMSs). This introspector uses DBMS-specific tables and views as a source of metadata. In addition to "standard" info, it can retrieve DBMS-specific details and thus produce a more precise picture of your database objects.

  • A JDBC-based introspector (available for all the DBMSs). This introspector uses the metadata provided by the corresponding JDBC driver. It can retrieve only standard info about the database objects and their properties.

The JDBC-based intorspector should be used only when the native introspector fails (if this is the case, select the checkbox) or is not available (in such a case the checkbox is missing).

(The native introspector may fail, for example, when your DB server version is older than the minimum version supported by IntelliJ IDEA, when you are using Amason Redshift because it "pretends" that it's a Postgres while in fact it isn't, etc.)

Load sources for

IntelliJ IDEA will load source code of database objects for the selected category of schemas.

You can change this setting for several data sources at once. To do that, select the data sources of interest in the left-hand pane of the dialog. Then, in the context menu, point to Load Sources and select the necessary option.

Switch schema

Define a mode that IntelliJ IDEA uses to switch schemas.
  • Automatic: switch schemas automatically or manually.

  • Manual: switch schemas manually only.

  • Disable: do not switch schemas.

Code style

Select a code style that you want to use for schemas. For more information about code style customization, read Code styles for SQL.

Advanced tab

On this tab, you can configure the database connection properties, and also specify the options and environment variables for the database driver JVM.

Item

Description

Name - Value

The set of connection options passed to the database driver as key - value pairs at its start.

When you select a cell in the Name column, the description of the corresponding option is shown underneath the table.

To find an option of interest, just start typing its name.

To start editing a value, click or double-click the corresponding Value field, or press F2.

To add a row, start editing the values in the last row, where <user defined> and <value> are shown. A new row will be added to the table automatically.

VM Options

The options for the JVM in which the database driver runs. (The driver is started as a separate process in its own JVM.)

Example. For certain Oracle Database versions (e.g. for version 9), there may be connection problems when you and your database server are in different time zones. Specifying the time offset for your timezone may help, e.g. -Duser.timezone=UTC+03:00.

Alternatively, you can try setting the variable oracle.jdbc.timezoneAsRegion to false in the Name - Value table.

VM Environment

Environment variables for the database driver JVM.

Example. Sometimes, when working with Oracle, your data and/or error messages don't display correctly. Many of such problems are encoding-related and can be solved by appropriately setting the NLS_LANG variable, e.g. NLS_LANG=Russian_CIS.CL8MSWIN1251. For more information, see e.g. Oracle NLS_LANG FAQ.

To start editing the variables, click browseButton.

For additional information, refer to your DBMS documentation.

DDL data source settings

A DDL data source is defined by its name, and can reference one or more DDL files and/or another data source (a parent data source).

Item

Description

Name

Use this field to edit the data source name.

DDL Files

Use the controls in this area to compose the list of files that contain the necessary DDL definitions.
  • icons general add svg (Alt+Insert). Use this icon or shortcut to add a DDL SQL file or files to the data source definition. In the dialog that opens, select the necessary file or files.

  • icons general remove svg (Alt+Delete). Use this icon or shortcut to remove the selected file or files from the list.

  • icons actions previousOccurence svg (Alt+Up). Use this icon or shortcut to move the selected file one line up in the list.

  • icons actions nextOccurence svg (Alt+Down). Use this icon or shortcut to move the selected file one line down in the list.

Extend

Optionally, you can select another data source as a parent in the Extend drop-down list. As a result, the data source that you are editing inherits all DDL definitions from its parent.

If you do not want to use the parent data source, select <none>.

Driver settings

Settings tab

Shown on this tab are mainly the defaults for the General tab.

Item

Description

Class

The fully qualified name of the driver class to be used.

Dialect

The SQL dialect associated with the corresponding data sources. Via the data sources this dialect will "propagate" to the database console.

In addition to particular dialects, also the following option is available:

  • <Generic SQL>. Basic SQL92-based support is provided including completion and highlighting for SQL keywords, and table and column names. Syntax error highlighting is not available. So all the statements in the input pane are always shown as syntactically correct.

Tx

Auto or Manual. The default setting for the Tx (transaction control) option.

Auto sync

The default setting for the auto sync option.

Send application info

When connecting to a database server, IntelliJ IDEA sends the info about itself if this checkbox is selected.

JDBC drivers

The JDBC driver to be used to interact with a database. You can download and use a driver from the IntelliJ IDEA driver repository (see Use provided driver) or specify the driver that you already have available on your computer (see Additional).

Use provided driver. If the checkbox is selected, the driver from the repository is used.

To download and use the latest driver version, click the red <driver name> [latest] link. (If the link isn't red, the latest driver version has already been downloaded.)

You can also specify that you want to use the latest available driver or the driver with a particular version number. To do that, right-click the link, point to the driver name, and select Latest or the version number. If the selected version has not been yet downloaded, it will be downloaded automatically.

Additional. The files specified in this area are used in addition to the downloaded driver if the Use provided driver checkbox is selected, or instead of the downloaded driver otherwise.

Say, you want to use the driver that is already available on your computer. In that case, you should clear the Use provided driver checkbox, click icons general add svg and select the driver files (usually one or more .jar files) in the dialog that opens.

URL templates

The templates used to construct the database URL. The text in curly brackets represents variables, e.g.
  • {host} the domain name or IP address of the database host.

  • {port} the database port number.

  • {database} the name of the database or schema.

Optional fragments are in square brackets, e.g. [:{port}].

Template names correspond to the names of the options in the URL options list.

Advanced tab

Shown on this tab are the default settings for the Advanced tab.

Item

Description

Name - Value

The default set of connection options passed to the database driver as key - value pairs at its start.

To start editing a value, double-click the corresponding Value field.

To add a row, start editing the values in the last row, where <user defined> and <value> are shown. A new row will be added to the table automatically.

VM Options

The default options for the JVM in which the database driver runs. (The driver is started as a separate process in its own JVM.)

Problems

If potential problems are detected, there is a number to the right of Problems. In that case, if you click Problems, you'll see the list of problems as well as controls for fixing them.

Last modified: 20 November 2018

See Also

Language and Framework-Specific Guidelines: