RubyMine 2023.3 Help

Data Sources and Drivers dialog

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in RubyMine by default. If the relevant features aren't available, make sure that you didn't disable the plugin.

  1. Press Control+Alt+S to open the IDE settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

To access the Data Sources and Drivers dialog (Shift+Enter), perform one of the following actions:

  • In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties button the Data Source Properties button.

  • In the Database tool window ( View | Tool Windows | Database) , click the Add button the Add button and navigate to Data Source | <data_source_vendor>.

Overview

In the Data Sources and Drivers dialog, you can manage your data sources and database drivers.

the Data Sources and Drivers dialog

Data sources and drivers

When you select an item from the list of data sources and drivers, settings of the item appear in the right-hand part of the dialog.

Toolbar

Item

Shortcut

Description

the Add button

Alt+Insert

Create a data source or a driver.

the Remove icon

Delete

Remove the selected item or items from the list.

the Duplicate icon

Control+D

Create a copy of the selected data source or driver.

the Go to Driver icon

Control+B

Navigate to the driver settings that are associated with the selected data source.

the Make Global icon the Move to Project icon

Move the selected data source to the global or project level. For more information about global and project levels, refer to Data sources.

the Back icon the Forward icon

Switch between recently-used items.

Context menu

Item

Shortcut

Description

the Add button Add

Alt+Insert

Create a data source or a driver.

    the Remove icon Remove

    Delete

    Remove the selected item or items from the list.

    the Duplicate icon Duplicate

    Control+D

    Create a copy of the selected data source or driver.

    the Go to Driver icon Go to Driver

    Control+B

    Navigate to the driver settings that are associated with the selected data source.

    the Make Global icon Make Global

    the Move to Project icon Move to Project

    Move the selected data source to the global or project level. For more information about global and project levels, refer to Data sources.

    Change Driver

    Associate a data source with a driver.

    the Reset Changes icon Reset Changes

    Control+Alt+Z

    Revert changes for the selected item.

    Load Sources

    Load source code of database objects for the selected category of schemas.

    the Show Driver Usages icon Show Driver Usages

    Alt+F7

    Show data sources that use the selected driver.

    Data source settings

    Settings pane of a data source includes the following tabs: General, Options, SSH/SSL, Schemas, Advanced.

    General

    Options for password storage

    The General tab includes settings that you need to specify for a database connection.

    The set of fields and controls on the tab depends on the option that is selected in the Connection type list.

    Item

    Description

    Connection type

    A connection type that you want to use for the database connection.

    • 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 username 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), RubyMine 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).

    Driver

    Specify the driver from the Drivers list that you want to use for the connection.

    File

    The path to the database file.

    Use the Open icon (The Open icon) to select an existing database file.

    The Save icon (the Save button) creates a copy of a database file and changes a path to the copy location.

    Path

    The path to the database file or folder.

    Use the Open icon (The Open icon) to select an existing database file or a folder.

    Host

    The hostname (domain name) or the IP address (IPv4 or IPv6) of the computer where 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

    The database port number.

    Database

    The name of the target database or schema.

    User

    The name of your database user account.

    Password

    The password for the database user.

    Save

    Save settings for the password field. You can select the following options for storing your password:

    • Never: password is prompted each time you establish a connection with a database.

    • Until restart: password is saved only for the current RubyMine run. If you exit RubyMine and open it again, you must provide the password again.

    • For session: password is saved only for the current connection session with a database (until you disconnect from it). You can terminate the connection by pressing the Deactivate icon (the Terminate icon) or Control+F2.

    • Forever: password is saved in the RubyMine storage. You do not need to provide the password next time you open RubyMine.

    • IDE Passwords Settings: click to access the IDE password storage settings. You can also access them by opening the Appearance & Behavior | System Settings | Passwords page of the IDE settings Control+Alt+S. For more information about the IDE passwords settings, refer to the Passwords topic.

    Create database

    Adds an argument to the URL to create a database. This option is available only in some database management systems (for example, in the Apache Derby (Embedded)).

    URL

    The URL that RubyMine will use to connect to the database. The user interface for specifying the URL is different depending on which option is selected in the Connection type list.

    Test Connection

    Verifies that the database connection settings are correct and RubyMine can communicate with the database. To copy the communication information, click the Copy.

    Options

    The Options tab includes settings of the database connection.

    The set of fields and controls on the tab depends on the option that is selected in the Connection type list.

    Item

    Description

    Connection

    Read-only

    Set the read-only status. Select the checkbox to protect the data source from accidental data modifications.

    If the checkbox is selected, you cannot modify the data in the Data editor.

    Data modifications might be possible in the query console if the driver does not support the read-only status.

    Transaction control

    Set the isolation level for database transactions and the mode of how the transactions are committed.

    • Auto: the current transaction is committed automatically when you submit your local changes to the database server.

    • Manual: changes submitted to the database server are accumulated in a transaction that can either be committed or rolled back.

    Switch schema

    Define a mode that RubyMine uses to switch schemas.

    • Automatic: switch schemas automatically or manually. When this option is enabled, the previously configured search path or the current schema are restored automatically between IDE restarts.

    • Manual: switch schemas manually only.

    • Disable: do not switch schemas.

    Single session mode

    Enable the single session mode. Single session mode means that the data source and all consoles use one and the same session. This mode allows you to see the temporary objects in the database tree, or use the same transaction in different consoles. For more information about consoles, refer to Query consoles.

    Run keep-alive query each N seconds

    Run a keep-alive query to keep the connection alive. You can define the custom query in the driver settings for unsupported databases.

    Auto-disconnect after N seconds

    Disconnect from the database after the specified number of seconds.

    Enable DBMSOUTPUT

    (Oracle, IBM Db2 LUW) Enable DBMS_OUTPUT by default for new sessions.

    Single database mode

    In the database tree view, show and enable only the database that you specified in the connection settings.

    When you connect to a data source, RubyMine can retrieve and display you all the databases that the data source has. But in some cases (for example, with certain settings of PgBouncer), you can or are allowed to work only with a certain database. In the database tree view with the Single database mode enabled, you see only the database that you specified in the connection settings.

    Consider using this setting for PostgreSQL, Azure SQL Database, Greenplum, Amazon Redshift.

    Startup script

    Run an SQL query each time you establish a connection.

    Note: if the Single session mode checkbox is cleared, each new query console creates a new connection.

    Introspection

    Auto sync

    Synchronize the actual state of the database automatically. The state of the database means the database tree view that you see in the Database tool window.

    If the Auto sync checkbox is selected, the view of the data source is automatically updated:

    • 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.

    If the Auto sync checkbox is cleared, the view of the data source in the Database tool window is synchronized with the actual state of the database only when you click the Refresh button the Refresh button or press Control+F5) in the toolbar.

    Load sources for

    Load source code of views, procedures, packages and other database objects for the selected category of schemas: all schemas (All schemas), all schemas excluding system schemas (All excl. system schemas), or disable the feature (None).

    To change this setting for several data sources simultaneously, select the corresponding data sources. Right-click the selection and navigate to Load Sources and select an option.

    Warn when editing outdated DDL

    Display a notification if the cached DDL differs from the actual DDL in the database.

    Every time you open source code, RubyMine displays you a version that is loaded during the indexing process. But if someone changes the source code from another workstation, the indexed version becomes outdated.

    If your version is older than the one in the database, you see the following notification: Cached object differs from the object in the database.

    Track databases/schemas creation and deletion

    When you create, delete, or rename a schema, RubyMine updates the list of available schemas in the introspection scope window. To see the introspection scope, click the button near the data source name in the Database tool window.

    Introspection scope window

    Use pre-introspected objects for system catalogs that are not introspected

    Toggles the usage of pre-introspected objects for system catalogs. For more information about introspection and system catalogs, refer to Pre-introspected objects from system catalogs.

    Automatic introspection interval N minutes

    Run introspection for the data source once in the specified number of minutes.

    Virtual objects and attributes

    Defines a path to external-data.xml that stores relations of virtual foreign keys, expressions of virtual columns, and statements of virtual views.

    For more information about virtual database objects, refer to the Virtual objects section topics.

    Other

    Code style

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

    Before connection

    Select tasks that RubyMine will perform before the first connection (at the start of a process in which the JDBC driver works). Tasks are run sequentially.

    SSH/SSL

    The SSH/SSL tab includes settings for the SSH or SSL connection.

    SSH

    Item

    Description

    Use SSH tunnel

    Select this checkbox to enable connecting via SSH. Then choose one of the created SSH configurations, or click the Browse button and create a new configuration .

    SSH configuration

    Select an SSH configuration to use for the connection.

    To create a new SSH configuration, click the Add SSH configuration button (the Browse button). Alternatively, press Shift+Enter.

    To copy the existing SSH configuration, click the Copy button (the Copy Configuration button button).

    SSL

    Item

    Description

    Use SSL tunnel

    Enable settings for configuring the SSL connection.

    Copy from

    Copy SSH settings from the existing data source.

    Click the link and select the corresponding data source.

    CA file

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

    Use truststore

    Select the truststore to use the certificates that it contains.

    • IDE: Use the certificates that are accepted by the IDE. You can add new accepted certificates in Tools | Server Certificates.

    • JAVA: Use JAVA truststore certificates.

    • System: Use System truststore certificates.

    JAVA and System certificates can require updates.

    Client certificate file

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

    Client key file

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

    Schemas

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

    Item

    Description

    the Refresh button

    Refresh the list of the databases and schemas.

    the Expand All button

    Expand all nodes in all trees.

    the Collapse All button

    Collapse all nodes in all trees.

    the Filter field

    Filter the contents in trees. Only the databases and schemas whose names contain the specified text are shown.

    Schema pattern

    Define a pattern to select the necessary databases and schemas. To get the info about the syntax to be used, place the caret into the field and press Control+Q.

    • @: the current database or schema.

    • *: every database or schema. You can list schemas after *:.

    Consider the following examples:

    • *:*: all schemas in all databases.

    • @:*: all schemas from the current database

    • @:@: only the current schema

    • *:dbo|@:@|db1:s1,s2,s3: the dbo schema from all databases, the current schema, schemas s1,s2,s3 from the db1 database.

    Object filter

    Limit the set of tables and other database objects that are shown in the Database tool window for each data source.

    For example, if you limit the resolve scope to table:actor.*, then only the actor table will be accessible in the Database tool window ( View | Tool Windows | Database).

    All other tables will be out of the scope. RubyMine does not resolve objects that are not displayed in the Database tool window.

    Object is not resolved

    Use the following pattern when you compose an expression for the Object filter field.

    <type>:[-]<pattern>, where:

    • <type> might be an aggregate, collation, event, fdw, ftable, mview, operator, package, role, routine, sequence, synonym, table, user, view, vtable.

    • <pattern> is a regular expression. To exclude an item, prepend with - (minus). For more information about regular expressions, refer to Class Patterns at JavaTM 2 Platform Standard Edition 5.0 API Specification.

    Show internal system schemas

    Show or hide internal system schemas (for example, pg_toast or pg_temp). The option is available for PostgreSQL only.

    Show template databases

    Show or hide template databases (for example, template1, template0). The option is available for PostgreSQL only.

    Advanced

    The Advanced tab includes the database connection properties, options and environment variables for the JVM database driver.

    The table on the Advanced tab displays a set of connection options that are passed to the database driver as key and value pairs.

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

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

    Item

    Description

    VM options

    JVM options for the database driver.

    For certain Oracle Database versions (for example, Oracle version 9), there might be connection problems when you and your database server are in different time zones. You can specify the time offset for your timezone in the VM Option field (for example, -Duser.timezone=UTC+03:00). Alternatively, set the variable oracle.jdbc.timezoneAsRegion to false in the table on the Advanced tab.

    VM environment

    Environment variables for the database driver JVM.

    For example, encoding-related issues in an Oracle database can be solved by setting the NLS_LANG variable (like NLS_LANG=Russian_CIS.CL8MSWIN1251). For more information, refer to Oracle NLS_LANG FAQ.

    Working directory

    The working directory for the process that handles working with data sources. Also, all relative paths are resolved relatively to this directory (for example, paths in driver properties).

    For example, if you create a file-based database like SQLite and do not set the path for the SQLITE file, the file will be created in this working directory.

    For more 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 another data source (a parent data source).

    Item

    Description

    Name

    The data source name.

    Sources

    List of files that contain the necessary DDL definitions.

    • the Add button Alt+Insert. Add a DDL SQL file or files to the data source definition. In the dialog that opens, select the necessary file or files.

    • the Remove button (Alt+Delete). Remove the selected file or files from the list.

    • the Up button (Alt+ArrowUp). Move the selected file one line up in the list.

    • the Down button (Alt+ArrowDown). Move the selected file one line down in the list.

    Extend

    Optionally, you can select another data source as a parent in the Extend 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 pane of a driver includes the following tabs: General, Options, Advanced.

    Settings

    The General tab includes settings for driver files, URL templates, and driver classes.

    Item

    Description

    Class

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

    Driver Files

    RubyMine uses JDBC drivers to interact with a database. You can download and use a driver from the RubyMine driver repository or specify the driver that you store on your computer.

    To download and use the latest driver version, click the Download ver. N link.

    You can also specify and use a driver with a particular version number. Click the ver. <version_number> link and select the driver version that you want to use. The selected version is downloaded and applied automatically.

    You can use the driver that is already available on your computer. In that case, click the Add button the Add button and select the driver files (with the JAR extension).

    URL templates

    The templates used to construct the database URL. The text in curly brackets represents variables. Consider the following examples:

    • {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, for example, [:{port}].

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

    Options

    Item

    Description

    Connection

    Transaction control

    Set the isolation level for database transactions and the mode of how the transactions are committed.

    • Auto The current transaction is committed automatically when you submit your local changes to the database server.

    • Manuall The changes submitted to the database server are accumulated in a transaction that can either be committed or rolled back.

    Switch schema

    Define a mode that RubyMine uses to switch schemas.

    • Automatic: switch schemas automatically or manually.

    • Manual: switch schemas manually only.

    • Disable: do not switch schemas.

    Startup script

    An SQL query that will run each time you establish a connection.

    Note: if the Single session mode checkbox is cleared, each new query console creates a new connection.

    Keep-alive query

    A keep-alive query that will run to keep the connection alive.

    Introspection

    Auto sync

    The default setting for the auto sync option.

    Load sources for

    Load source code of database objects for the selected category of schemas.

    Send application info

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

    Connection

    Dialect

    The SQL dialect associated with the corresponding data sources.

    Code style

    Selects a code style that you want to use for the data sources that use this driver. For more information about code style customization, refer to Code styles for SQL.

    Format synced sources

    Apply the code style to source code of database objects after synchronization.

    Advanced

    The Advanced tab includes JVM options, environment variables, and options that can be passed to the database driver as key-value pairs.

    To start editing a value in the table, 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.

    Item

    Description

    VM Options

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

    VM environment

    Environment variables for the database driver JVM.

    For example, encoding-related issues in an Oracle database can be solved by setting the NLS_LANG variable (like NLS_LANG=Russian_CIS.CL8MSWIN1251). For more information, refer to Oracle NLS_LANG FAQ.

    Expert options

    Item

    Description

    Disable incremental introspection

    Do not perform the incremental introspection. The option is available for Oracle, Microsoft SQL Server, PostgreSQL and similar databases, .

    With the incremental introspection, the introspector detects objects changed in the database after the previous introspection and loads only these objects. When you enable this option, the introspector always loads all objects. It might greatly increase the introspection time.

    Do not use xmin in queries to pgdatabase

    Do not use the xmin attribute in queries to the pg_database table. Use this workaround when xmin is absent in pg_database. Note that your database might be corrupted. The option is available only for PostgreSQL.

    Introspect using JDBC metadata

    Switch to the JDBC-based introspector. Available for all the databases.

    To retrieve information about database objects (DB metadata), RubyMine uses the following introspectors:

    • A native introspector (might be unavailable for certain DBMS). The native introspector uses DBMS-specific tables and views as a source of metadata. It can retrieve DBMS-specific details and produce a more precise picture of database objects.

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

    Consider using the JDBC-based introspector when the native introspector fails or is not available.

    The native introspector can fail when your database server version is older than the minimum version supported by RubyMine.

    You can try to switch to the JDBC-based introspector to fix problems with retrieving the database structure information from your database. For example, when the schemas that exist in your database or database objects below the schema level are not shown in the Database tool window.

    Isolate class path

    Isolate class path used by JDBC driver.

    Use IDE proxy settings

    Passes IDE proxy settings to JDBC process.

    Kubernetes

    With RubyMine, you can connect to a database running in a Kubernetes cluster.

    The Kubernetes tab is not available for embedded databases (for example, SQLite, Apache Derby, or HSQLDB) that don't have dedicated ports.

    Item

    Description

    Use Kubernetes port forwarding

    Enables port forwarding.

    Context

    Select a Kubernetes context to use.

    Namespace

    Select a namespace, which determines the available set of resources.

    Resource type

    Select the type of resource.

    Resource

    Select a resource to connect to.

    Host port

    Enter a local port to forward data to and from.

    Container port

    Enter a remote port of the cluster resource.

    Problems

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

    Last modified: 11 January 2024