I could really use this feature - the years keep spinning by and I still can't access. Any ETA on Cosmos DB access, even the cosmos db emulator would be a big plus.
There are 3 main ways to connect to a CosmosDB: Postgres, NoSQL, and Mongo - depends on how the instance was created.
I just created all 3 test Cosmos DBs and I was able to connect to all of them. Postgres and Mongo can use the included with DataGrip drivers for those databases just fine. But the https://www.cdata.com/drivers/cosmosdb/jdbc/ driver for the NoSQL version, which has no username/password and uses this format instead jdbc:cosmosdb:AccountEndpoint=myAccountEndpoint;AccountKey=myAccountKey; connects without showing any data. It requires to fill in its Advanced options and also plug the URL field in this format:
When I try to view Schemas/Data I get this error: “[HY000] The function 'db_id' is not supported.”
CData is not a free driver though, not to mention it simply does not work (at least I could not find the right options to make it work). There seems to be an existing Cosmos DB driver for Intellij https://devblogs.microsoft.com/cosmosdb/intellij-idea-support/ - can it be used here? Are there any other drivers you or someone could recommend to connect to a NoSQL CosmosDB?
As far as I know, Azure Toolkit does not provide any JDBC drivers. They provide additional connection properties and matching connectivity logic.
We haven't officially tested this driver. You can collect the driver logs and upload them to https://uploads.jetbrains.com so that we can take a look at how exactly the driver reacts to our connection request.
Since you have a specific use case with a particular error code, you can also try contacting CData support. Maybe they can advise something.
Upload the installed CData JDBC Driver for Cosmos DB to create a User Driver in Datagrip.
Navigate to the Advanced Tab and Access Expert Options:
In Datagrip, navigate to the Advanced tab and click on Expert Options located in the bottom right corner.
Set the DBMS property to UNKNOWN and apply the changes.
Note: This step is crucial as it resolves the identified issue.
Create a Data Source Using the Driver:
With the adjustments made in the Expert Options, you can now proceed to create a data source using the CData JDBC Driver.
Generate the Connection String using the JAR file in the driver's installation directory OR by directly setting the properties in the Advanced tab.
Default Directory: C:\Program Files\CData\CData JDBC Driver for Azure Cosmos DB 2023\lib\cdata.jdbc.cosmosdb.jar
Data Retrieval
These steps should be followed for each CData JDBC Driver.
By following these steps, you should be able to establish a connection to Cosmos DB. If you encounter any difficulties you can reach out to support@cdata.com.
If there is a JDBC driver for Cosmos DB you can connect and work with it.
I could really use this feature - the years keep spinning by and I still can't access. Any ETA on Cosmos DB access, even the cosmos db emulator would be a big plus.
There is an issue for Native Cosmos DB support https://youtrack.jetbrains.com/issue/DBE-6857
You can use Azure CosmosDB jdbc driver for connection from within DataGrip https://www.jetbrains.com/help/datagrip/configuring-database-connections.html#create-a-connection-with-JDBC-driver
You can use Azure CosmosDB jdbc driver for connection from within DataGrip
Are there any steps on how to do this? I don't see any CosmosDB JDBC driver in the driver list…
Greg
That is because there is no out-of-the-box support for this type of database in DataGrip (which is what DBE-6857 is about).
What you can do now is:
Arina Efremova
There are 3 main ways to connect to a CosmosDB: Postgres, NoSQL, and Mongo - depends on how the instance was created.
I just created all 3 test Cosmos DBs and I was able to connect to all of them. Postgres and Mongo can use the included with DataGrip drivers for those databases just fine. But the https://www.cdata.com/drivers/cosmosdb/jdbc/ driver for the NoSQL version, which has no username/password and uses this format instead
jdbc:cosmosdb:AccountEndpoint=myAccountEndpoint;AccountKey=myAccountKey;
connects without showing any data. It requires to fill in its Advanced options and also plug the URL field in this format:When I try to view Schemas/Data I get this error: “[HY000] The function 'db_id' is not supported.”
CData is not a free driver though, not to mention it simply does not work (at least I could not find the right options to make it work). There seems to be an existing Cosmos DB driver for Intellij https://devblogs.microsoft.com/cosmosdb/intellij-idea-support/ - can it be used here? Are there any other drivers you or someone could recommend to connect to a NoSQL CosmosDB?
Hi Sergey Ivanov
Did you try using the mentioned Azure ToolKit for IntelliJ plugin to resolve this?
I could not find the jar file from that plugin.
Arina Efremova you recommended https://www.cdata.com/drivers/cosmosdb/jdbc/. Any examples of a successful usage?
Sergey Ivanov
As far as I know, Azure Toolkit does not provide any JDBC drivers. They provide additional connection properties and matching connectivity logic.
We haven't officially tested this driver. You can collect the driver logs and upload them to https://uploads.jetbrains.com so that we can take a look at how exactly the driver reacts to our connection request.
Since you have a specific use case with a particular error code, you can also try contacting CData support. Maybe they can advise something.
Please follow the steps outlined below to seamlessly connect to Cosmos DB using the CData JDBC Driver for Cosmos DB:
These steps should be followed for each CData JDBC Driver.
By following these steps, you should be able to establish a connection to Cosmos DB. If you encounter any difficulties you can reach out to support@cdata.com.