Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article provides API reference documentation for the Databricks JDBC Driver, version 3 and above.
IDatabricksConnection interface
Describes methods to retrieve connection and statement execution handles.
Package: com.databricks.jdbc.api
| getStatement |
|---|
IDatabricksStatement getStatement(String statementId) throws SQLExceptionReturns a handle for a given statement ID. Returns: An IDatabricksStatement to handle an existing execution. |
| getConnectionId |
|---|
String getConnectionId() throws SQLExceptionReturns a handle for the session connection. Returns: A String that represents the connection for the underlying session of the execution. |
IDatabricksDriver interface
Describes methods to manage the driver connection.
Package: com.databricks.client.jdbc
com.databricks.client.jdbc.Driver extends com.databricks.client.jdbc.IDatabricksDriver and java.sql.Driver.
| closeConnection |
|---|
void closeConnection(String url, Properties info, String connectionId) throws SQLExceptionCloses the connection for the specified connection ID and JDBC connection URL. Returns: None |
IDatabricksResultSet interface
Describes methods to retrieve results of an asynchronous query.
Package: com.databricks.jdbc.api
| getExecutionStatus |
|---|
IExecutionStatus getExecutionStatus() throws SQLExceptionReturns the status of the execution. Returns: An IExecutionStatus that represents the status of the execution |
| getStatementId |
|---|
String getStatementId() throws SQLExceptionReturns the associated statement-id of the async execution. Returns: A String that is the statement ID of the execution |
IDatabricksStatement interface
Describes methods to execute and handle an asynchronous query.
Package: com.databricks.jdbc.api
| executeAsync |
|---|
ResultSet executeAsync(String sql) throws SQLExceptionExecutes a SQL command in asynchronous mode. Parameters:
Returns: A ResultSet that represents the results of the executed SQL |
| getExecutionResult |
|---|
ResultSet getExecutionResult() throws SQLExceptionFetches a status and response for an already executed SQL command, and throws error if no command has been executed. This method can be called multiple times to poll execution status. Returns: A ResultSet that represents the results of the executed SQL |
IDatabricksVolumeClient interface
Describes methods to manage files in Unity Catalog volumes.
Package: com.databricks.jdbc.api
| prefixExists |
|---|
boolean prefixExists(String catalog, String schema, String volume, String prefix, boolean caseSensitive) throws SQLExceptionDetermines if a specific prefix (folder-like structure) exists in the Unity Catalog volume. The prefix must be a part of the file name. Parameters:
Returns: A boolean indicating whether the prefix exists or not. |
| objectExists |
|---|
boolean objectExists(String catalog, String schema, String volume, String objectPath, boolean caseSensitive) throws SQLExceptionDetermines if a specific object (file) exists in the Unity Catalog volume. The object must match the file name exactly. Parameters:
Returns: A boolean indicating whether the object exists or not. |
| volumeExists |
|---|
boolean volumeExists(String catalog, String schema, String volumeName, boolean caseSensitive) throws SQLExceptionDetermines if a specific volume exists in the given catalog and schema. The volume must match the volume name exactly. Parameters:
Returns: A boolean indicating whether the volume exists or not. |
| listObjects |
|---|
List<String> listObjects(String catalog, String schema, String volume, String prefix, boolean caseSensitive) throws SQLExceptionReturns the list of all filenames in the Unity Catalog volume that start with a specified prefix. The prefix must be a part of the file path from the volume as the root. Parameters:
Returns: A list of strings indicating the filenames that start with the specified prefix. |
| getObject (file) |
|---|
boolean getObject(String catalog, String schema, String volume, String objectPath, String localPath) throws SQLExceptionRetrieves an object (file) from the Unity Catalog volume and stores it in the specified local path. Parameters:
Returns: A boolean value indicating status of the GET operation. |
| getObject (stream) |
|---|
InputStreamEntity getObject(String catalog, String schema, String volume, String objectPath) throws SQLExceptionRetrieves an object as an input stream from the Unity Catalog volume. Parameters:
Returns: An instance of the input stream entity. |
| putObject (file) |
|---|
boolean putObject(String catalog, String schema, String volume, String objectPath, String localPath, boolean toOverwrite) throws SQLExceptionUploads data from a local path to a specified path within a Unity Catalog volume. Parameters:
Returns: A boolean value indicating the status of the PUT operation. |
| putObject (stream) |
|---|
boolean putObject(String catalog, String schema, String volume, String objectPath, InputStream inputStream, long contentLength, boolean toOverwrite) throws SQLExceptionUploads data from an input stream to a specified path within a Unity Catalog volume. Parameters:
Returns: A boolean value indicating status of the PUT operation. |
| deleteObject |
|---|
boolean deleteObject(String catalog, String schema, String volume, String objectPath) throws SQLExceptionRemoves an object from a specified path within a Unity Catalog volume. Parameters:
Returns: A boolean value indicating the status of the DELETE operation. |
IDatabricksGeospatial interface
Describes methods to work with geospatial data types (GEOMETRY and GEOGRAPHY). This interface is extended by IGeometry and IGeography marker interfaces for type-specific geospatial objects.
Package: com.databricks.jdbc.api
| getWKT |
|---|
String getWKT()Returns the Well-Known Text (WKT) representation of the geospatial object. Returns: A String containing the WKT representation without SRID prefix. |
| getWKB |
|---|
byte[] getWKB()Returns the OGC-compliant Well-Known Binary (WKB) representation of the geospatial object. Returns: A byte array containing the WKB data. |
| getSRID |
|---|
int getSRID()Returns the Spatial Reference System Identifier (SRID) of the geospatial object. Returns: An integer representing the SRID value (0 if not specified). |
| getType |
|---|
String getType()Returns the geospatial type name. Returns: A String that is either GEOMETRY or GEOGRAPHY. |
ExecutionState enum
Contains the states of an executing asynchronous query.
Package: com.databricks.jdbc.api
RUNNING |
The statement is running on the server |
|---|---|
PENDING |
The statement is yet to run on the server |
SUCCEEDED |
The statement ran successfully |
FAILED |
The statement execution failed |
ABORTED |
The statement was aborted |
CLOSED |
The statement has been closed |
IExecutionStatus interface
Describes methods to retrieve the status of an asynchronous query.
Package: com.databricks.jdbc.api
| getExecutionState |
|---|
ExecutionState getExecutionState() throws SQLExceptionReturns the state of the execution status. Returns: An ExecutionState that represents the state of the execution status |
| getSqlState |
|---|
String getSqlState() throws SQLExceptionIf it is set, returns the SQLState code for a failed status. Returns: A String that is the SQLState code |
| getErrorMessage |
|---|
String getErrorMessage() throws SQLExceptionReturns the error message of a failed execution. Returns: A String that is the error message. |