PyCharm 2016.3 Help

Data Sources and Drivers Dialog

To access this dialog from the Database tool window: /help/img/idea/iconManageDataSources.png or /help/img/idea/new.png on the toolbar


Use this dialog to manage your data sources and database drivers, and their settings.

A driver here is understood as a collection that includes database driver files, and also default options and settings for creating a DB data source.

The names of new, yet unsaved items are shown in the left-hand pane in green. New items are saved when clicking Apply or OK.

See also, Managing Data Sources.

Left-hand pane

Shown in this pane are your data sources and drivers. When you select an item, its settings are shown 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.

Icon and commandShortcutDescription
/help/img/idea/new.png AddAlt+InsertUse this icon, command or shortcut to create a new data source or driver. Select:
  • 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.

/help/img/idea/delete.png RemoveDeleteUse this icon, command or shortcut to remove the selected item or items from the list.
/help/img/idea/copy.gif DuplicateCtrl+DUse this icon, command or shortcut to create a copy of the selected data source or driver.
/help/img/idea/settings.png Go to DriverCtrl+BUse this icon, command or shortcut to view or edit the settings for the driver associated with the selected DB data source.
/help/img/idea/icon_importCopyrightProfile.png Make Global or Move to ProjectUse 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 DriverIf more than one driver is available for the selected DB data source, use this command to associate the data source with a different driver.
Show Driver UsagesAlt+F7Use 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.
Reset ChangesCtrl+Alt+ZUse this command or shortcut to undo the changes made to the selected item.
/help/img/idea/arrowBack.png /help/img/idea/arrowForward.pngUse these icons to switch between the items you've been workings with.

DB data source settings

Name

ItemDescription
NameUse this field to edit the name of the data source.

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.

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

/help/img/idea/browseButton.png lets you select an existing database file.

/help/img/idea/new.png lets you create a new database file.

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

/help/img/idea/browseButton.png lets you select the database file or folder.

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

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

PortSpecify the database port number.
DatabaseSpecify the name of the target database or schema.
UserSpecify the name of the database user (i.e. your database user account name).
PasswordSpecify the password for the database user.
Remember passwordSelect this check box if you want PyCharm to save the password in its password database. Later, instead of the password, you may be asked for your master password. (The master password is used to access the password database.)
URLShown in this field is the URL that PyCharm 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), PyCharm 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 ConnectionClick this button to make sure that the database connection settings are correct and PyCharm can communicate with the target database.
DriverClick the <driver name> link to switch to the settings for the associated driver.
Read-onlySelect this check box 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 Table Editor.

Whether data modifications will be possible by means of the consoles depends on the DBMS: PyCharm 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.

For example, if you define your MySQL data source as read-only, the driver won't let you switch schemas in associated database consoles (see e.g. Selecting the default schema or database). In that case, you should use the Database field to specify your current schema or database.

Auto commitThe default setting for the Auto-commit option in the table editor and the database console.
Auto syncIf 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 (/help/img/idea/refresh.png 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 check box and specify the associated settings.

Item Description
SSH
Use SSH tunnel Select this check box to set up and use an SSH tunnel for accessing a remote database via an SSH proxy.
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 PyCharm 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 /help/img/idea/browseButton.png (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 check box if you want PyCharm to save the password or the passphrase in its password database. Later, instead of the password or the passphrase, you may be asked for your master password. (The master password is used to access the password database.)
SSL. All the files specified in this section should be in PEM format. Which of the files you have to specify, depends on the SSL properties of your user account.
Use SSL Select the check box to use SSL when connecting to the server.
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 fileSpecify 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 /help/img/idea/browseButton.png (Shift+Enter) and select the file in the dialog that opens.

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

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

Client key fileSpecify the path to your (client) private key file.

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

Options tab

The settings on this tab relate to filtering database objects, resolving unqualified references, etc.

ItemDescription
Object filter You can limit the set of tables and other database objects shown in the Database tool window by specifying a filter. The filter is applied to "short" (i.e. unqualified) names of the database objects.

Examples:

f.* Only the objects whose names start with f will be shown.

table:[gh].* The tables whose names start with g or h and all the objects in other categories will be shown.

view:new_.*||routine:-[ps].* The views whose names start with new_, the routines whose names start with the letters other than p or s, and all the objects in the categories other than views and routines will be shown.

Plan table For Oracle: The name of the table that should be used to store the EXPLAIN PLAN output information.
Resolve unqualified references To be able to reference the tables and other database objects by their "short" names in your database consoles and SQL files, select the corresponding check boxes. Otherwise, only fully qualified object names (schema_name.object_name) will be treated by PyCharm as valid.

Note that the DBMS may reject short names when you execute the corresponding statement or statements.

Introspect using JDBC metadata You may want to select this check box (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 PyCharm 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 check box) or is not available (in such a case the check box is missing).

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

Load sources forThe schema category for which you want to load the database object sources.

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 /help/img/idea/browseButton.png.

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.
  • /help/img/idea/new.png (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.
  • /help/img/idea/delete.png (Alt+Delete). Use this icon or shortcut to remove the selected file or files from the list.
  • /help/img/idea/arrowUp.png (Alt+Up). Use this icon or shortcut to move the selected file one line up in the list.
  • /help/img/idea/arrowDown.png (Alt+Down). Use this icon or shortcut to move the selected file one line down in the list.
Extend If necessary, select another data source as a parent. As a result, the data source whose properties you are editing will "inherit" all the DDL definitions from its parent.

If the parent data source is not needed, select <none>.

Driver settings

Name

Item Description
Name Use this field to edit the name of the driver.

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>. 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.
Auto commit The default setting for the auto commit option.
Auto sync The default setting for the auto sync option.
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.

Driver files Shown in this area is the list of the driver files. Use:
  • The download link to download the necessary driver files.
  • /help/img/idea/new.png (Alt+Insert) to add the files available locally to the list.
  • /help/img/idea/delete.png (Alt+Delete) to remove unnecessary files from the list. (No files are physically deleted.)

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.

See Also

Language and Framework-Specific Guidelines:

Last modified: 23 November 2016