New Databricks JDBC driver version doesn't recognize JDBC URL - jdbc

I had been using the Databricks JDBC driver version 2.6.22 and tried to upgrade to 2.6.27. However, after upgrading I get messages saying my JDBC URLs are invalid when trying to connect. These JDBC URLs work fine with the old version of the driver and I pull them directly from the Databricks SQL endpoint info, so I expect something else is going on.
Example JDBC URL:
jdbc:spark://[workspace domain]:443/default;transportMode=http;ssl=1;AuthMech=3;httpPath=/sql/1.0/endpoints/[identifier]
I noticed between versions the name went from SimbaSparkJDBC42-2.6.22.1040 to DatabricksJDBC42-2.6.27.1048 and the JAR class name went from com.simba.spark.jdbc.Driver to com.databricks.client.jdbc.Driver. Does dropping Simba mean there was a more major change? Do I need to correct my JDBC URLs somehow?
I'm downloading my driver from here
I'm using DBeaver as my SQL client if that makes a difference.

JDBC URLs for the new databricks driver start with jdbc:databricks: instead of jdbc:spark:. As of now, JDBC URL details in the UI still use the old format, just replace spark with databricks and they should work. Mentioned here

Databricks has a different URL format, check the documentation here
Basically in the url replace spark to databricks and add PWD parameter.
jdbc:databricks://[workspace domain]:443/default;transportMode=http;ssl=1;AuthMech=3;httpPath=/sql/1.0/endpoints/[identifier];PWD=[your_access_token]
PWD is the personal access token. Instructions to get access token.

Related

Tableau driver-resolver definition for JDBC Drivers in a custom connector

I'm trying to figure out how to get Tableau to recognize my JDBC Driver when creating a custom JDBC connector using the Tableau Connector SDK . Currently when Tableau loads my custom connector I can tell the driver is not found because there is a link that shows up in the Connector that says:
"Download and install the drivers, and then connect."
Tableau online does not have the drivers for the SAS data I want to connect to: so I cannot download the drivers to install from Tableau
Luckily I already have the .jar files and have placed them at C:\Program Files\Tableau\Drivers on Windows
In the Connector API Reference "driver-resolver" states that: "This is mainly used for ODBC connections but can be used for JDBC as well" but I do not see specific instructions for working with JDBC drivers explicitly. Except for the Postgres JDBC Example which DOES NOT use a driver-resolver. I also have not seen a JDBC example in the Resolvers github samples
In the Tableau logs I can see that the .jar files containing my driver are recognized by searching for their names, they are shown in the logs.
Logs Environment Section Excerpt:
"environment","v":{...all my jar files listed here}
Drivers not being recognized screenshot that says to download the drivers
Finally, here is what my .tdr file looks like with my current driver-resolver definition that does not work
<tdr class='sas_jdbc'>
<connection-resolver>
<connection-builder>
<script file="connectionBuilder.js" />
</connection-builder>
<connection-properties>
<script file="connectionProperties.js" />
</connection-properties>
</connection-resolver>
<driver-resolver>
<driver-match>
<driver-name type='exact'>com.sas.rio.MVADriver</driver-name>
</driver-match>
</driver-resolver>
</tdr>
Can anyone shed some light on this for me? I feel like I'm close. An example using a JDBC driver-resolver in a .tdr file would be nice.
You don't actually need a .tdr file with JDBC, as all the driver resolution happens in the connectionBuilder.js file today. The URL of the connection there includes the driver name. I added a story to our backlog to make this more clear. I should also mention, that hopefully you are using 2019.4 or higher for the best experience. Thanks for using the SDK!
The answer to this is that driver-resolver is not used in JDBC custom connector definitions. The problem I'm experiencing with getting the SAS JDBC Driver to work is because the SAS JDBC Driver is JDBC Type 2.0. JDBC Drivers need to be Type 4.0 to work with a Tableau custom connector using the Tableau Connector SDK.
The resolution is to use a Type 4.0 JDBC Driver which I have not seen from SAS yet.

Error connecting SQL Workbench/J to Amazon Athena

I've been having a lot of problems connecting SQL Workbench/J to Amazon Athena through the JDBC connector. Also, the instructions seem to vary between these two help resources:
http://docs.aws.amazon.com/athena/latest/ug/athena-sql-workbench.html
https://s3.amazonaws.com/athena-downloads/drivers/JDBC/docs/Simba+Athena+JDBC+Driver+Install+and+Configuration+Guide.pdf
Here's the error message:
[Simba]JDBC Connection Refused: [Simba]JDBC Required Connection Key(s): AwsRegion; [Simba]JDBC Optional Connection Key(s): AwsCredentialsProviderArguments, AwsCredentialsProviderClass, BinaryColumnLength, ComplexTypeColumnLength, ConnectTimeout, MaxCatalogNameLength, MaxColumnNameLength, MaxErrorRetry, MaxSchemaNameLength, MaxTableNameLength, ProxyHost, ProxyPort, ProxyPWD, ProxyUID, S3OutputEncOption, Schema, SocketTimeout, StringColumnLength, UseAwsLogger
The documentation at #1 is deprecated, as you might gather from the different filenames in the two guides. Amazon hasn't fully cleaned up their docs, since switching from their homegrown JDBC driver to the driver they've OEMed from Simba.
You did not provide the JDBC URL you're using, so I cannot provide a specific correction, but the error message you got seems pretty clear -- you apparently didn't build your JDBC URL correctly. It's missing the mandatory AwsRegion setting.
Note the URL syntax from the PDF guide for the JDBC driver you're using --
jdbc:awsathena://AwsRegion=[Region];UID=[AccessKey];PWD=[SecretKey];S3OutputLocation=[Output];[Property1]=[Value1];[Property2]=[Value2];...
Here is how I have done it
Make sure you have Java8 installed
Download the latest Athena jar
Make a new driver in sql work bench
Add the jdbc connection and username/password
location would be location you logged into the account and what setting is in the url Thus my url is: jdbc:awsathena://athena.us-east-2.amazonaws.com:443
Username= Access Key Id; Password= Secret Access Key
Then do not forget the extended properties! set the s3_staging_dir to the bucket you created for your Athena results, or you will need to look and see what the default bucket is created. This bucket must start with aws-athena-query-results
Update version 2.07
Bucket is now S3OutputLocation not s3_staging_dir:

Using BigQuery in DataGrip with JDBC

Has anyone been able to use the new JDBC drivers for BigQuery in JetBrains DataGrip?
I've followed the these steps
Created a driver in DataGrip with all the jar files
Created a database with a connection string with a service account file
The connection test says successful, but once I try to query something I receive an error:
java.lang.ClassNotFoundException: com.google.api.client.json.JsonFactory
I've added the following files from the Simba ZIP into the DataGrip driver:
GoogleBigQueryJDBC42.jar
jackson-core-2.1.3.jar
google-api-client-1.22.0.jar
google-api-services-bigquery-v2-rev320-1.22.0.jar
google-http-client-1.22.0.jar
google-http-client-jackson2-1.22.0.jar
google-oauth-client-1.22.0.jar
So I'm not sure what to do next. I tried changing their order in DataGrip but it didn't seem to make a different.
My connection string also looks OK I think:
jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=...;OAuthType=0;OAuthPvtKeyPath=...;OAuthServiceAcctEmail=...;
You may get this error when the driver JAR files are not referenced correctly in the tool. I have listed out the steps I used to connect to BigQuery via DataGrip.
Add a new driver by adding all the JAR files from the zip. The correct class name should be selected from the "Class" drop down in this step.
Add a new data source by selecting the newly created BigQuery JDBC driver. Provide the correct connection URL in this step.
If the test connection succeeds, create a new query for the same datasource.
Make sure your query uses the correct format "dataset.tablename" and is running on the data source you just tested.
For me replacing P12 with Json worked. But, cannot use DataGrip or in general JDBC to access BigQuery because of various query/incompatibility issues.
This video can be referred : https://www.youtube.com/watch?v=r9l2c_aQPoQ&ab_channel=JetBrainsTV
to use the new simba jdbc drivers for BigQuery in JetBrains DataGrip. It covers all steps one by one for working setup.
Here is the blog which refers this video: https://blog.jetbrains.com/datagrip/2018/07/10/using-bigquery-from-intellij-based-ide/
Drivers can be downloaded at : https://cloud.google.com/bigquery/providers/simba-drivers
Note: Make sure to go through comments on blog to authenticate without creating service account on gcp.
Hope this is helpful!

LibreOffice Base JDBC connection to Hive returns “Method not supported” when executing valid select statement

I'm trying to get LibreOffice's Base v5.1.4.2, running on Ubuntu v16.04 to connect to a Hive v1.2.1 database via JDBC. I added the following jars, downloaded from Maven Central, to LibreOffice's classpath ('Tools -> LibreOffice -> Advanced -> Class Path'):
hive-common-1.2.1.jar
hive-jdbc-1.2.1.jar
hive-metastore-1.2.1.jar
hive-service-1.2.1.jar
hadoop-common-2.6.2.jar
httpclient-4.4.jar
httpcore-4.4.jar
libthrift-0.9.2.jar
commons-logging-1.1.3.jar
slf4j-api-1.7.5.jar
I then restarted LibreOffice, opened Base, selected 'Connect to an existing database' -> 'JDBC' and set the following properties:
I entered the credentials and clicked the 'Test Connection' button, which returned a "the connection was established successfully" message. Great!
In the LibreOffice Base UI, the options under the 'Tables' panel were grayed out. The options in the queries tab were not, so I tried to connect to Hive.
The 'Use Wizard to Create Query' option prompts for a password and then returns "The field names from 'airline.on_time_performance' could not be retrieved."
The JDBC connection is able to connect to Hive and list the tables, though it seems to have problems retrieving the columns. When I try to execute a simple select statement, the 'Create Query in SQL View' option returns a somewhat cryptic "Method not supported" message:
The error message is a bit vague. I suspect that I may be missing a dependency since I am able to connect to Hive from Java using JDBC.
I'm curious to know if anyone in the community has LibreOffice Base working with Hive. If so, what am I missing?
The Apache JDBC driver reports "Method not supported" for most features, just because the Apache committers did not bother to handle the list of simple yes/no API calls. Duh.
If you want to see by yourself, just download DBVisualizer Free, configure the Apache Hive driver, open a connection, and check the Database Info tab.
Now, DBVis is quite permissive with lame drivers, but it seems that LibreOffice is not.
You can try the Cloudera Hive JDBC driver as an alternative. You just have to "register" -- i.e. leave your e-mail address -- to access the download URL; it's simpler to deploy than the Apache thing (based on the Simba SDK, all Hive-specific JARs are bundled) and it works with about any BI tool. So hopefully it works with LibreThing too.
Disclaimer: I wish the Apache distro had a proper JDBC driver, and anyone could use it instead of relying of "free" commercial software. But for now it's just a wish.

Is there a google supported JDBC driver for BigQuery?

We are looking to access BigQuery through third party sql clients, ex. RazorSql. I came across StarSchema JDBC driver and I could not make it work with Razorsql and on the webpage it says that the project was archived. So, not sure if its supposed to work. Any suggestions?
The error I get when trying to use it with RazoeSql is:
java.io.IOException: toDerInputStream rejects tag type 123
I am using a service account key file for authentication.
This is JDBC url value I use (where "my-poc" is the project id and "MY_POC" is the dataset name):
jdbc:BQDriver:my-poc%3AMY_POC?withServiceAccount=true
Alas, no there isn't a JDBC driver that is officially supported. There is an ODBC driver developed by Simba in conjunction with google (you can download it here for free), and you can use a JDBC to ODBC bridge (although the official one is deprecated in java 8, I believe you can download one from a couple of different folks (here, for example).
Admittedly, this is not a great solution. IMO Google really should provide a JDBC driver, but they do not.
java.io.IOException: toDerInputStream rejects tag type 123
The JDBC driver requires a p12 formatted file instead of the json formatted file.

Resources