Skip to content

datasource create

dbeaver-devops edited this page Dec 2, 2026 · 2 revisions

Table of contents

Synopsis

dbvr datasource create [-hV] --driver=<driver>
                             [-p=<dbPassword>] [--project=<projectIdOrName>]
                             [-secret=<secretName>] [-sm=<secretManagerId>]
                             [-u=<dbUser>]
                             [-auth=<authParams> | --auth-property=<authParams>]...
                             [-ext=<providerParams> | --extended-property=<providerParams>]...
                             [-prop=<connectionParams> | --property=<connectionParams>]...
                             [[-net=<handlerParams> | --network-handler-param=<handlerParams>]...
                              [-net-save-pwd=<savePassword> | --network-handler-save-password=<savePassword>]]
                             [[--auth-model=<authModel>]
                              [--folder=<folder>]
                              [--name=<dataSourceName>]
                              [--save-password=<savePassword>]
                              [--url=<url> |
                               [[--host=<host>]
                                [--database=<dbName>]
                                [--server=<server>]
                                [--port=<port>]]]]

Tip: You can also use global options with this command.

Tip: You can create a connection in the DBeaver UI and then use it in dbvr. Both tools use the same workspace format. For step-by-step instructions, see Create connection.

Description

Create a new datasource.

The datasource definition is written to the active workspace configuration, making it available for other dbvr commands such as sql, datasource list, or datasource update.

Required option

--driver=<driver>

Important: The --driver value must match a registered driver. Use driver list to see available Driver IDs.

Connection options

Define the new datasource inline with --driver and connection parameters.

Include credentials, network handlers, and driver-specific properties if required.

For information on connection parameters, credentials, network handlers, and driver-specific properties, see Connection options.

Options

--project

--project=<projectIdOrName>

Store the datasource in the specified project. If not set, the datasource is created in the current default project.

Tip: Run project list to see available projects and identify the current default.

Examples

Create a basic PostgreSQL datasource in the General project. This example requires a local PostgreSQL server running on port 5432 with a postgres database. Add --user and --password if your server requires credentials.

dbvr datasource create \
  --driver=postgres-jdbc \
  --name=pg-docs \
  --project=General \
  --host=localhost \
  --port=5432 \
  --database=postgres

Run datasource list to find the datasource, then datasource view to inspect its configuration.

Create a datasource in a specific project and folder:

dbvr datasource create \
  --driver=postgres-jdbc \
  --name=pg-prod \
  --project=Prod \
  --folder=Finance \
  --host=prod-db \
  --database=maindb \
  --user=app \
  --password=secret

Create a datasource using a full JDBC URL:

dbvr datasource create \
  --driver=postgres-jdbc \
  --name=pg-url \
  --url=jdbc:postgresql://localhost:5432/testdb \
  --user=app \
  --password=secret

Create a datasource configuration with key-based SSH authentication. This command stores the configuration; it doesn't test the connection or supply a database password or private key passphrase.

dbvr datasource create \
  --driver=postgres-jdbc \
  --name=pg-ssh \
  --host=db.example.com \
  --database=testdb \
  --user=db_user \
  -net=ssh.host=ssh.example.com \
  -net=ssh.port=22 \
  -net=ssh.user=ssh_user \
  -net=ssh.authType=PUBLIC_KEY \
  -net=ssh.keyPath=/absolute/path/id_ed25519 \
  -net-save-pwd=false

For information on running a query with a private argument file containing the required credentials, see Connection options.

Clone this wiki locally