[spark][sparksql][odbc][jdbc] JDBC and ODBC drivers and configuration parameters

JDBC and ODBC drivers and configuration parameters

April 08, 2021

You can connect business intelligence (BI) tools to Databricks Workspace clusters and SQL Analytics SQL endpoints to query data in tables. This article describes how to get JDBC and ODBC drivers and configuration parameters to connect to Databricks Workspace clusters and SQL Analytics SQL endpoints. For tool-specific connection instructions, see Business intelligence tools.

Permission requirements

The permissions required to access compute resources using JDBC or ODBC depend on whether you are connecting to a Databricks Workspace cluster or SQL Analytics SQL endpoint.

Workspace cluster requirements

To access a cluster, you must have Can Attach To permission.

If you connect to a terminated cluster and have Can Restart permission, the cluster is started.

SQL Analytics SQL endpoint requirements

To access a SQL endpoint, you must have Can Use permission.

If you connect to a stopped endpoint and have Can Use permission, the SQL endpoint is started.

Prepare to connect BI tools

This section describes the steps you typically follow to prepare to connect to BI tools:

Step 1: Download and install a JDBC or ODBC driver

For some BI tools you use a JDBC or ODBC driver to make a connection to Databricks compute resources.

  1. Go to the Databricks JDBC or ODBC driver download page and download it. For ODBC, pick the right driver for your operating system.
  2. Install the driver. For JDBC, a JAR is provided which does not require installation. For ODBC, an installation package is provided for your chosen platform.

Step 2: Collect JDBC or ODBC connection information

To configure a JDBC or ODBC driver, you must collect connection information from Databricks. Here are some of the parameters a JDBC or ODBC driver might require:

Parameter Value
Authentication See Username and password authentication.
Host, port, HTTP path, JDBC URL See Get server hostname, port, HTTP path, and JDBC URL.

The following are usually specified in the httpPath for JDBC and the DSN conf for ODBC:

Parameter Value
Spark server type Spark Thrift Server
Schema/Database default
Authentication mechanism AuthMech See Username and password authentication.
Thrift transport http
SSL 1

Username and password authentication

This section describes how to collect the credentials for authenticating BI tools to Databricks compute resources.

When you configure authentication from your BI tool to Databricks resources the fields you set are labeled Username and Password. If SSO is enabled, set Username to the string token and Password to a personal access token. If SSO is disabled, you can either set Username to token and Password to a personal access token or set Username to your Databricks username and Password to your password.

Get server hostname, port, HTTP path, and JDBC URL

The procedure for retrieving JDBC and ODBC parameters depends on whether you are using Databricks Workspace clusters and SQL Analytics SQL endpoints.

Workspace cluster

  1. Click the Clusters Icon icon in the sidebar.

  2. Click a cluster.

  3. Click the Advanced Options toggle.

  4. Click the JDBC/ODBC tab.

    JDBC-ODBC tab
  5. Copy the parameters required by your BI tool.

SQL Analytics SQL endpoint

  1. Click the Endpoints Icon icon in the sidebar.

  2. Click an endpoint.

    경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
    어린이용이며, 설치가 필요없는 브라우저 게임입니다.
    https://s1004games.com

  3. Click the Connection Details tab.

    Connection details
  4. Copy the parameters required by your BI tool.

Configure JDBC URL

The steps for configuring the JDBC URL depend on whether you are using a Databricks Workspace cluster or a SQL Analytics SQL endpoint.

Workspace cluster

In the following URL, replace <personal-access-token> with the token you created in Username and password authentication. For example:

 
jdbc:spark://<server-hostname>:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/0/xxxx-xxxxxx-xxxxxxxx;AuthMech=3;UID=token;PWD=<personal-access-token>

SQL Analytics SQL endpoint

Replace <personal-access-token> with the token you created in Username and password authentication. For example:

 
jdbc:spark://<server-hostname>:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/0/xxxx-xxxxxx-xxxxxxxx;AuthMech=3;UID=token;PWD=<personal-access-token>

Configure connection for native query syntax

JDBC and ODBC drivers accept SQL queries in ANSI SQL-92 dialect and translate the queries to Spark SQL. If your application generates Spark SQL directly or your application uses any non-ANSI SQL-92 standard SQL syntax specific to Databricks, Databricks recommends that you add ;UseNativeQuery=1 to the connection configuration. With that setting, drivers pass the SQL queries verbatim to Databricks.

Configure ODBC Data Source Name for the Simba ODBC driver

The Data Source Name (DSN) configuration contains the parameters for communicating with a specific database. BI tools like Tableau usually provide a user interface for entering these parameters. If you have to install and manage the Simba ODBC driver yourself, you might need to create the configuration files and also allow your Driver Manager (ODBC Data Source Administrator on Windows and unixODBC/iODBC on Unix) to access them. Create two files: /etc/odbc.ini and /etc/odbcinst.ini.

/etc/odbc.ini

  1. Set the content of /etc/odbc.ini to:

    ini
    [Databricks-Spark]
    Driver=Simba
    Server=<server-hostname>
    HOST=<server-hostname>
    PORT=<port>
    SparkServerType=3
    Schema=default
    ThriftTransport=2
    SSL=1
    AuthMech=3
    UID=token
    PWD=<personal-access-token>
    HTTPPath=<http-path>
    
  2. Set <personal-access-token> to the token you retrieved in Username and password authentication.

  3. Set the server, port, and HTTP parameters to the ones you retrieved in Get server hostname, port, HTTP path, and JDBC URL.

/etc/odbcinst.ini

Set the content of /etc/odbcinst.ini to:

ini
[ODBC Drivers]
Simba = Installed
[Simba Spark ODBC Driver 64-bit]
Driver = <driver-path>

Set <driver-path> according to the operating system you chose when you downloaded the driver in Step 1:

  • MacOs /Library/simba/spark/lib/libsparkodbc_sbu.dylib
  • Linux (64-bit) /opt/simba/spark/lib/64/libsparkodbc_sb64.so
  • Linux (32-bit) /opt/simba/spark/lib/32/libsparkodbc_sb32.so

Configure paths of ODBC configuration files

Specify the paths of the two files in environment variables so that they can be used by the Driver Manager:

ini
export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc/odbcinst.ini
export SIMBASPARKINI=<simba-ini-path>/simba.sparkodbc.ini # (Contains the configuration for debugging the Simba driver)

where <simba-ini-path> is

  • MacOS /Library/simba/spark/lib
  • Linux (64-bit) /opt/simba/sparkodbc/lib/64
  • Linux (32-bit) /opt/simba/sparkodbc/lib/32

 

[출처] https://docs.databricks.com/integrations/bi/jdbc-odbc-bi.html

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
공지 오라클 기본 샘플 데이터베이스 졸리운_곰 2014.01.02 86157
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 78651
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 95385
42 [ms sql server] SQL Server 2019 Express 외부 접속을 위한 처리 file 졸리운_곰 2024.07.27 1603
41 [ms sql server] MS-SQL 2019 Express 와 SSMS 를 설치하고 DB, 사용자 추가 후 네트워크 설정하기 file 졸리운_곰 2024.07.27 1521
40 데이터 입력/수정/삭제를 한 번에 처리할 수 있는 MERGE에 대해 알아보자 file 졸리운_곰 2020.09.10 1854
39 SQL Server PIVOT : ms sql server Row Column Pivot 로우 컬럼변환 file 졸리운_곰 2020.06.13 1614
38 MSSQL 로우를 컬럼으로 졸리운_곰 2020.06.13 1663
37 [MS SQL] FROM - PIVOT 및 UNPIVOT 사용 졸리운_곰 2020.06.13 957
36 [MSSQL] 3개 이상 테이블 조인 file 졸리운_곰 2020.05.16 1601
35 [MSSQL] 경고: 집계 또는 다른 SET 연산에 의해 Null 값이 제거되었습니다. 졸리운_곰 2020.01.31 1673
34 [MSSQL] 경고: 집계 또는 다른 SET 작업에 의해 Null 값이 제거되었습니다. file 졸리운_곰 2020.01.31 1876
33 MS-SQL 트리거 사용하기 (간략 공략!?!?) file 졸리운_곰 2020.01.31 1455
32 [ms sql server] T-SQL 저장 프로시져 만들기 : CREATE PROCEDURE(Transact-SQL) file 졸리운_곰 2020.01.27 1925
31 [ms sql server] 저장 프로시저 만들기 file 졸리운_곰 2020.01.27 1102
30 Installing Microsoft SQL Server in Docker SQL Server and Docker file 졸리운_곰 2020.01.26 9140
29 MS SQL Stored Procedure file 졸리운_곰 2020.01.26 1687
28 [MSSQL] 저장 프로시저 만들기 실습 file 졸리운_곰 2020.01.26 1667
27 MS-SQL 에서 한글 검색이 안되는 경우 졸리운_곰 2020.01.24 1423
26 mssql 2012 언어변경 질문드립니다. file 졸리운_곰 2020.01.23 1501
25 [MS-SQL] 쿼리문 정리 file 졸리운_곰 2020.01.23 1939
24 [DB/Docker/MSSQL] Docker + MSSQL 개발하기 졸리운_곰 2020.01.23 1368
23 Linux에서 환경 변수를 사용하여 SQL Server 설정 구성 file 졸리운_곰 2020.01.23 1241
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED