Configure database connections
When you create connection to a database, GoLand connects to a database automatically to receive database objects. Then the connection closes. Names of data sources that interact with a database are shown in the Database tool window with a little green circle.
If you want to close a database connection, select a data source and click the Deactivate button () on the toolbar. Alternatively, select a data source and press CtrlF2.

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 GoLand run. If you exit GoLand 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 (
) or CtrlF2.
Forever: password is saved in the GoLand storage. You do not need to provide the password next time you open GoLand.
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 CtrlAlt0S. For more information, refer to Passwords.

GoLand does not include bundled drivers in order to have a smaller size of the installation package and to keep driver versions up-to-date for each IDE version. Upon setting up a new database connection, GoLand provides a link for you to download the missing driver.
You can find the downloaded JDBC drivers in the Configuration directory.

For direct download links, refer to the JetBrains JDBC drivers page.
You can also specify your drivers for the data source instead of the provided ones.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
In the Data Sources and Drivers dialog, click the Drivers tab, and select a driver entry that you want to modify.
Click the Driver link in data source settings.
Some data sources have a list with drivers for different versions (for example, MySQL). In these cases, select Go to driver from the list.
In the Driver files pane, click the version number, and select the driver version that you need.
You can add libraries to the existing driver or replace the driver completely.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
Click the Driver link in data source settings and select Go to Driver.
Click the provided driver entry, and click Remove (
).
To revert changes, click the Roll back Changes icon (
) that is in the lower-right part of the window.
In the Driver Files pane, click the Add icon (
) and select Custom JARs….
In the file browser, navigate to the JAR file of the JDBC driver, select it, and click OK.
In the Class field, specify the value that you want to use for the driver .
Click Apply.
You can keep the connection to a database alive by running a keep-alive query after the specified period. You can define the custom query in the driver settings for unsupported databases.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, select the Run keep-alive query each checkbox and type a number of seconds after which GoLand must run a keep-alive query again.
tip
To set a custom keep-alive query for a driver, select the necessary driver on the Drivers tab. Click the Options tab. In the Keep-alive query field, specify the query that you want to use as a keep-alive query.
You can specify a period in seconds after which GoLand terminates the connection.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, select the Auto-disconnect after checkbox and type a number of seconds after which GoLand terminates the connection.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, in the Startup script field, specify the query that you plan to run on a connection to a database.
If someone changed the remote database data or view, the local view of the database might differ from the actual state of the database.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, select the Auto sync checkbox.
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 icon (
) in the toolbar or press CtrlF5.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Schemas tab, type filtering options in the Object filter field.
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, see Class Patterns at JavaTM 2 Platform Standard Edition 5.0 API Specification.tip
Also, you can check the following video at youtube.com that describes how to hide objects that you do not need by using the object filter.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Schemas tab, type filtering options in the Schema pattern field.
@
: 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
: thedbo
schema from all databases, the current schema, schemass1,s2,s3
from thedb1
database.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, select the Read-only checkbox.
Single session mode means that the data source and all consoles use one and the same connection. This mode allows you to see the temporary objects in the database tree, or use the same transaction in different query consoles. For more information about query consoles, read Query consoles.
When you apply single session mode, you must close all existing opened connections. GoLand displays a notification if you have opened connections. To close opened connections for the selected data source, click Yes. To close opened connections for all modified data sources, click Yes for All.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, select Single session mode.
Click Apply.
note
If the Single session mode checkbox is cleared, each new query console creates a new connection.
When you connect to a data source, GoLand 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. With the Single database mode enabled, you see in the database tree view only the database that you specified in the connection settings, not all the databases that were received from the data source.
Consider using this setting, for PostgreSQL, Azure SQL Database, Greenplum, Amazon Redshift.
Open data source properties. You can open data source properties by using one of the following options:
In the Database tool window ( View | Tool Windows | Database) , click the Data Source Properties icon
.
Press CtrlAltShift0S.
On the Data Sources tab, select a data source that you want to modify.
On the Options tab, select Single database mode.
Click Apply.
Thanks for your feedback!