IntelliJ IDEA 13.0.0 Web Help

Some features described here are available in Ultimate edition only.

To access this dialog from the Database tool window:

  • When creating a new data source:
    Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+Insert or Ctrl+NAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter or New in the context menu, then select Data Source.
    If there are data sources already defined, select any of the data sources first.
  • For an existing data source:
    EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter or Properties in the context menu.

Use this dialog to configure a DB data source.

Data source name, Scope and the Test Connection button

Item Description
Data source name Use this field to edit the name of the data source.
Scope Select:
  • Project if the data source should be available only in the current project.
  • IDE if the data source should be available in all of your projects.
Test Connection Click this button to make sure that the database connection settings are correct and IntelliJ IDEA can communicate with the target database. (This button is located in the lower-left part of the dialog.)

Database tab

Item Description
JDBC driver files Specify the JDBC driver to be used to interact with the database.

Use the list options to download the necessary driver files from the Internet (the corresponding option names include the word download), or select the driver files associated with a different data source (the <data source name> driver options).

If the corresponding driver files are available locally on your computer, click browseButton (Shift+EnterShift+EnterShift+EnterShift+EnterShift+EnterShift+EnterShift+EnterShift+EnterShift+EnterShift EnterShift EnterShift Enter) and select the driver file location(s) in the dialog that opens.

JDBC driver class Select the name of the class that implements the necessary JDBC driver. (The list includes all the driver classes detected in the specified driver files.)
Database URL Specify the URL of the target database. For example, for a MySQL database the URL may look something similar to this:

jdbc:mysql://<db_host>:<db_port>/<db_name>

where

<db_host> is the hostname (domain name) or the IP address of the computer on which the database is located,
<db_port> is the database port (3306 by default for MySQL) and
<db_name> is the name of the database.

Note that if SSH is used to access the database, the database host and port are specified in the Configure SSH Tunnel dialog. In this field, you should specify localhost or 127.0.0.1 in place of the target DB host and the local SSH port in place of the DB port.

Using the MySQL example above, you would specify

jdbc:mysql://localhost:<local_ssh_port>/<db_name>

in this field.

<local_ssh_port> here is the local SSH port specified in the SSH tunnel will be opened... field of the Configure SSH Tunnel dialog.

The database host and port information would be specified in that dialog too, in the Remote DB host and Port fields respectively.

To configure SSH access to the database, click Configure SSH.

User Specify the name of the database user (i.e. your database user account name).
Password Specify the password for the database user.
Auto sync Select this check box to enable auto-synchronization of the data source view in the Database tool window. As a result, the view will be automatically updated when you change the database properties or run the corresponding DDL statements in the console. Thus, you won't need to perform the Synchronize command (Ctrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YAlt Command YAlt Command YAlt Command Y) for the corresponding database.

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+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YCtrl+Alt+YAlt Command YAlt Command YAlt Command Y), and only for the appropriate database parts such as separate tables.

Configure SSH If the target database should be accessed using SSH, click this button and specify the associated settings in the Configure SSH Tunnel dialog that opens.

See also, Database URL.

Schemas & Tables tab

In this tab, specify the schemas or table name patterns to restrict the set of accessible tables in the target databases.

Tip

Specifying a schema makes sense if the target database supports schemas.

Item Description
Schemas This read-only field lists all the schemas that are currently available in the system.
Scan for Tables Select the check boxes next to the schemes which you want to use for retrieving tables. If you select the check box next to *, tables will be scanned in all schemes.
Make Default If you select this check box next to a schema, the names of the tables accessed through this schema will be resolved by IntelliJ IDEA so you do not need to write their fully qualified names.
Table Names Pattern In this text box, type a regular expression which determines the subset of accessible tables. IntelliJ IDEA will access the tables with names that match the specified pattern.

Tip

An asterisk * means that all available tables will be loaded.

Console tab

In this tab, configure the general behaviour of the Database Console tool window.

Item Description
Default SQL Dialect From this drop-down list, select the SQL dialect to be used by default.
Default Run Configuration In this drop-down list, specify the run configuration to launch the Database Console tool window.

Advanced tab

In this tab, configure the connection properties manually. This is necessary if your JDBC driver (for example, DB2) does not return the list of supported properties and therefore connection cannot be established successfully. To edit a parameter, click the Value field next to the desired parameter, and update the field contents as required.

See Also

Language and Framework-Specific Guidelines:

Reference:

Web Resources: