Configure a database connection
Configure the parameters of a new database connection using the interface provided for the selected database type. Read the procedures below to do the following:
Configure connection parameters based on the selected database type
(Optional) Configure SSH tunneling
(Optional) Configure database introspection scope
(Optional) Configure JDBC driver optional parameters
note
The procedures cover both basic cases of creating a database connection:
For a notebook
You want to create a database connection for a specific notebook you are working on right now. This will automatically attach the new connection to the notebook, which enables you to immediately retrieve and process its data in your code.
For a workspace
You have a database that you want to connect to one of your workspaces. As a workspace resource, you can later attach this connection to any notebook from the respective workspace.
In both cases, you will use Datalore's New database connection dialog, and the only difference between the two scenarios is accessing this interface.
The procedure depends on whether you want to add a new database connection to workspace resources or attach it to a notebook.
On the Home page, select the workspace to which you want to add a database connection.
From the left-hand menu of the selected workspace, select Data and switch to the Databases tab. This will open the list of all workspace database connections.
On the Databases tab, click the Add button in the upper right corner.
Open the Attached data tool from the left-hand sidebar.
Switch to the Databases tab. You will see the list of all database connections available from the respective workspace.
At the bottom of the tab, click New database.
This procedure describes the general workflow for all supported database types. For specific procedures, refer to the topics under this article.
note
Edit your database ACLUnless you're using Datalore On-Premises (in a private cloud or on-premises) or SSH tunneling, whitelist Datalore's 63.33.83.29 IP address for your database connections to grant access.
In the New database connection dialog, select a database type.
You will be forwarded to the General tab of the New [database_type_name] connection dialog.
On the General tab, fill in the fields to provide details required for the selected database type.
note
Find database-specific procedures in the list under this article.
(Optional) To configure SSH tunneling for your new connection, perform this procedure.
(Optional) To configure the database introspection scope, perform this procedure.
(Optional) To configure additional parameters for your connection, perform this procedure.
Click the Test connection button at the bottom of the dialog.
Once successfully tested, click the Create and close button.
This new method of establishing database connection provides faster sessions and improves overall data querying performance. At the same time, it makes no changes to the UI or user behaviour.
Currently, the feature is supported only for the following database types:
PostgreSQL
MySQL
MariaDB
Microsoft SQL Server
Snowflake
note
Note that this method does not currently support such features as OAuth authorization and custom JDBC options. Using any of them may result in connectivity issues.
To enable the new connection method, select the respective checkbox on the General tab of the New database connection dialog.
Datalore can create an SSH tunnel based on the parameters you configure in the New [database_type] connection dialog. This procedure is an optional step of configuring a database connection in the New database connection dialog.
Switch to the SSH tab of the New [database_type] connection dialog.
Select the SSH checkbox.
Provide your connection details in the Host, Port, and User fields.
Use one of the two authentication types:
To use password-based authentication, fill in the Password field.
To use a key pair:
Expand the Authentication type list and select Key pair.
Under Key pair, expand the list and select one of the key pairs you created for this workspace.
Click the Create and close button to finish your work in the dialog, or switch to another tab to continue configuring the connection.
This procedure is an optional step of configuring a database connection in the New database connection dialog.
Switch to the Schemas tab of the New [database_type] connection dialog.
Select or deselect schemas for introspection.
Click Create and close to finish your work in the dialog, or switch to another tab to continue creating the connection.
Use the Advanced tab of the database connection dialog to manage additional parameters. For example, you can manage your JDBC driver custom options here or specify your VM options.
Switch to the Advanced tab of the dialog.
Do one of the following:
Specify VM options
Enter the values in the VM options field.
tip
To expand the field for multiple lines input hover over the lower right corner, hold down the left mouse button and drag the border to the desired size.
Add a parameter
Click Add key-value pair. Repeat the previous step for each parameter required for your connection.
Click Create and close to finish your work in the dialog, or switch to another tab to continue creating the connection.
If created for a specific notebook, the new connection will be automatically added to the respective workspace. You can later attach this database connection to any other notebook from this workspace.
If created for a workspace, this connection is added to the workspace databases and can be attached to any notebook from this workspace.
If OAuth authentication was used for this connection, report users and notebook collaborators may be required to provide their credentials to access the database.
To retrieve and process data from the connected database, use Query data with SQL cells.
Thanks for your feedback!