This section describes how to connect to Azure Cosmos DB following the standard JDBC connection process in DBeaver: Add the driver JAR, provide the driver class name, and provide any Azure Cosmos DB-specific parameters in the JDBC URL.
Add the JDBC Driver for Azure Cosmos DB
Complete the following steps to add the driver .jar file:
- Open the DBeaver application and, in the Database menu, select the Driver Manager option. Click New to open the Create New Driver form.
- In the Driver Name box, enter a user-friendly name for the driver.
To add the .jar file, click Add File on the Libraries tab. Select the cdata.jdbc.cosmosdb.jar file, located in the lib subfolder of the installation directory.
Note that the.lic file must be located in the same folder as the .jar file.
- Click Find Class, and in the list select, "cdata.jdbc.cosmosdb.CosmosDBDriver".
- In the URL Template field, enter jdbc:cosmosdb:.
Create the JDBC Data Source
Complete the following steps to select the Azure Cosmos DB driver and build the JDBC URL to create the JDBC data source:
- In the main DBeaver window, click Database > New Connection.
- Select the driver definition you created in the dialog that is displayed.
- On the next page of the wizard, click the Driver Properties tab.
Enter any connection properties required to connect to Azure Cosmos DB.
Here is a typical connection string:
jdbc:cosmosdb:AccountEndpoint=myAccountEndpoint;AccountKey=myAccountKey;See Establishing a Connection for a connection and authentication guide.
- Finish creating the connection with the default settings or configure advanced network settings -- proxy, firewall, and SSH.
Discover Schemas and Query Azure Cosmos DB Data
Complete the following steps to query information from the tables exposed by the connection:
- Expand the node for the connection to access the database metadata.
- Browse the table metadata and edit the table data by right-clicking a Table and then clicking Edit Table.
To execute an SQL query, select SQL Editor > New SQL Editor and select the Azure Cosmos DB connection you created. You can then enter queries using code completion.