Java API reference for the Databricks JDBC Driver
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 |
---|
Returns a handle for a given statement ID. Returns: An IDatabricksStatement to handle an existing execution. |
getConnectionId |
---|
Returns 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 |
---|
Closes 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 |
---|
Returns the status of the execution. Returns: An IExecutionStatus that represents the status of the execution |
getStatementId |
---|
Returns 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 |
---|
Executes a SQL command in asynchronous mode. Parameters:
Returns: A ResultSet that represents the results of the executed SQL |
getExecutionResult |
---|
Fetches 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 |
---|
Determines 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 |
---|
Determines 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 |
---|
Determines 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 |
---|
Returns 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) |
---|
Retrieves 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) |
---|
Retrieves an object as an input stream from the Unity Catalog volume. Parameters:
Returns: An instance of the input stream entity. |
putObject (file) |
---|
Uploads 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) |
---|
Uploads 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 |
---|
Removes an object from a specified path within a Unity Catalog volume. Parameters:
Returns: A boolean value indicating the status of the DELETE operation. |
ExecutionState enum
Contains the states of an executing asynchronous query.
Package: com.databricks.jdbc.api
| The statement is running on the server |
---|---|
| The statement is yet to run on the server |
| The statement ran successfully |
| The statement execution failed |
| The statement was aborted |
| The statement has been closed |
IExecutionStatus interface
Describes methods to retrieve the status of an asynchronous query.
Package: com.databricks.jdbc.api
getExecutionState |
---|
Returns the state of the execution status. Returns: An ExecutionState that represents the state of the execution status |
getSqlState |
---|
If it is set, returns the SQLState code for a failed status. Returns: A String that is the SQLState code |
getErrorMessage |
---|
Returns the error message of a failed execution. Returns: A String that is the error message. |