Package com.databend.jdbc
Class DatabendConnection
java.lang.Object
com.databend.jdbc.DatabendConnection
- All Implemented Interfaces:
FileTransferAPI,AutoCloseable,Connection,Wrapper,java.util.function.Consumer<com.databend.client.DatabendSession>
public class DatabendConnection
extends Object
implements Connection, FileTransferAPI, java.util.function.Consumer<com.databend.client.DatabendSession>
-
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaccept(com.databend.client.DatabendSession session) voidvoidclose()voidcommit()voidcopyIntoTable(String database, String tableName, DatabendCopyParams params) Copy into the target table from files on the internal stage Documentation: https://databend.rs/doc/sql-commands/dml/dml-copy-into-tablebooleancreateArrayOf(String s, Object[] objects) createStatement(int resultSetType, int resultSetConcurrency) createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) createStruct(String s, Object[] objects) debug()downloadStream(String stageName, String sourceFileName, boolean decompress) Download a file from the databend internal stage, the data would be downloaded as one file with no split.booleanstatic StringgetCopyIntoSql(String database, DatabendCopyParams params) intokhttp3.OkHttpClientintcom.databend.client.PaginationOptionscom.databend.client.DatabendSessionintgetURI()booleanisClosed()booleanbooleanisValid(int i) booleanisWrapperFor(Class<?> aClass) voidprepareCall(String s, int i, int i1) prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String s, int autoGeneratedKeys) prepareStatement(String s, int[] ints) prepareStatement(String s, int i, int i1) prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String s, String[] strings) booleanvoidreleaseSavepoint(Savepoint savepoint) voidrollback()voidvoidsetAutoCommit(boolean b) voidsetCatalog(String s) voidsetClientInfo(String s, String s1) voidsetClientInfo(Properties properties) voidsetHoldability(int holdability) voidsetNetworkTimeout(Executor executor, int i) voidsetReadOnly(boolean b) voidvoidsetSession(com.databend.client.DatabendSession session) voidsetTransactionIsolation(int i) voidsetTypeMap(Map<String, Class<?>> map) tenant()<T> TvoiduploadStream(String stageName, String destPrefix, InputStream inputStream, String destFileName, long fileSize, boolean compressData) Method to put data from a stream at a stage location.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValidMethods inherited from interface java.util.function.Consumer
andThen
-
Method Details
-
getCopyIntoSql
-
getSession
public com.databend.client.DatabendSession getSession() -
setSession
public void setSession(com.databend.client.DatabendSession session) -
getHttpClient
public okhttp3.OkHttpClient getHttpClient() -
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
nativeSQL
- Specified by:
nativeSQLin interfaceConnection- Throws:
SQLException
-
commit
- Specified by:
commitin interfaceConnection- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommitin interfaceConnection- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommitin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceConnection- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaDatain interfaceConnection- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnlyin interfaceConnection- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnlyin interfaceConnection- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceConnection- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMapin interfaceConnection- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldabilityin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
createClob
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createBlob
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createNClob
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
isValid
- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
setSchema
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
abort
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
presignedUrlDisabled
public boolean presignedUrlDisabled() -
copyPurge
public boolean copyPurge() -
warehouse
-
strNullAsNull
-
useVerify
-
debug
-
tenant
-
nullDisplay
-
binaryFormat
-
getPaginationOptions
public com.databend.client.PaginationOptions getPaginationOptions() -
getURI
-
PingDatabendClientV1
- Throws:
SQLException
-
accept
public void accept(com.databend.client.DatabendSession session) - Specified by:
acceptin interfacejava.util.function.Consumer<com.databend.client.DatabendSession>
-
uploadStream
public void uploadStream(String stageName, String destPrefix, InputStream inputStream, String destFileName, long fileSize, boolean compressData) throws SQLException Method to put data from a stream at a stage location. The data will be uploaded as one file. No splitting is done in this method.Stream size must match the total size of data in the input stream unless compressData parameter is set to true.
caller is responsible for passing the correct size for the data in the stream and releasing the inputStream after the method is called.
Note this method is deprecated since streamSize is not required now. Keep the function signature for backward compatibility
- Specified by:
uploadStreamin interfaceFileTransferAPI- Parameters:
stageName- stage name: e.g. ~ or table name or stage namedestPrefix- path prefix under which the data should be uploaded on the stageinputStream- input stream from which the data will be uploadeddestFileName- destination file name to usefileSize- data size in the streamcompressData- whether to compress the data- Throws:
SQLException- failed to put data from a stream at stage
-
downloadStream
public InputStream downloadStream(String stageName, String sourceFileName, boolean decompress) throws SQLException Description copied from interface:FileTransferAPIDownload a file from the databend internal stage, the data would be downloaded as one file with no split.- Specified by:
downloadStreamin interfaceFileTransferAPI- Parameters:
stageName- the stage which contains the filesourceFileName- the file name in the stagedecompress- whether to decompress the data- Returns:
- the input stream of the file
- Throws:
SQLException
-
copyIntoTable
public void copyIntoTable(String database, String tableName, DatabendCopyParams params) throws SQLException Description copied from interface:FileTransferAPICopy into the target table from files on the internal stage Documentation: https://databend.rs/doc/sql-commands/dml/dml-copy-into-table- Specified by:
copyIntoTablein interfaceFileTransferAPI- Parameters:
database- the target table's databasetableName- the target table nameparams- copy options and file options- Throws:
SQLException
-