Package com.taosdata.jdbc
Class TSDBJNIConnector
- java.lang.Object
-
- com.taosdata.jdbc.TSDBJNIConnector
-
public class TSDBJNIConnector extends Object
-
-
Constructor Summary
Constructors Constructor Description TSDBJNIConnector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection()Execute close operation from C to release connection pointer by JNIbooleanconnect(String host, int port, String dbName, String user, String password)Get connection pointerlongconsume(long subscription)Consume a subscribed tablelongexecuteQuery(String sql)Execute DML/DDL operationintfetchRow(long resultSet, TSDBResultSetRowData rowData)Get one row dataintfreeResultSet()Close the open result set which is associated to the current connection.intfreeResultSet(long result)Free resultset operation from C to release resultset pointer by JNIintgetAffectedRows(long pSql)Get affected rows countintgetErrCode(Long pSql)Get recent error code by connectionStringgetErrMsg(Long pSql)Get recent error message by connectionlonggetResultSet()Get resultset pointer Each connection should have a single open result set at a timeintgetSchemaMetaData(long resultSet, List<ColumnMetaData> columnMetaData)Get schema metadatastatic StringgetTsCharset()static voidinit(String configDir, String locale, String charset, String timezone)Initialize static variables in JNI to optimize performancestatic voidinitImp(String configDir)booleanisClosed()Whether the connection is closedbooleanisResultsetClosed()Returns the status of last result set in current connectionstatic intsetOptions(int optionIndex, String optionValue)longsubscribe(String topic, String sql, boolean restart, int period)Subscribe to a table in TSDBlongsubscribeImp(long connection, boolean restart, String topic, String sql, int period)voidunsubscribe(long subscription, boolean isKeep)Unsubscribe a tablebooleanvalidateCreateTableSql(String sql)Validate if a create table sql statement is correct without actually creating that table
-
-
-
Method Detail
-
isClosed
public boolean isClosed()
Whether the connection is closed
-
isResultsetClosed
public boolean isResultsetClosed()
Returns the status of last result set in current connection
-
init
public static void init(String configDir, String locale, String charset, String timezone) throws SQLWarning
Initialize static variables in JNI to optimize performance- Throws:
SQLWarning
-
initImp
public static void initImp(String configDir)
-
setOptions
public static int setOptions(int optionIndex, String optionValue)
-
getTsCharset
public static String getTsCharset()
-
connect
public boolean connect(String host, int port, String dbName, String user, String password) throws SQLException
Get connection pointer- Throws:
SQLException
-
executeQuery
public long executeQuery(String sql) throws SQLException
Execute DML/DDL operation- Throws:
SQLException
-
getErrCode
public int getErrCode(Long pSql)
Get recent error code by connection
-
getResultSet
public long getResultSet()
Get resultset pointer Each connection should have a single open result set at a time
-
freeResultSet
public int freeResultSet(long result)
Free resultset operation from C to release resultset pointer by JNI
-
freeResultSet
public int freeResultSet()
Close the open result set which is associated to the current connection. If the result set is already closed, return 0 for success.
-
getAffectedRows
public int getAffectedRows(long pSql)
Get affected rows count
-
getSchemaMetaData
public int getSchemaMetaData(long resultSet, List<ColumnMetaData> columnMetaData)Get schema metadata
-
fetchRow
public int fetchRow(long resultSet, TSDBResultSetRowData rowData)Get one row data
-
closeConnection
public void closeConnection() throws SQLExceptionExecute close operation from C to release connection pointer by JNI- Throws:
SQLException
-
subscribe
public long subscribe(String topic, String sql, boolean restart, int period)
Subscribe to a table in TSDB
-
subscribeImp
public long subscribeImp(long connection, boolean restart, String topic, String sql, int period)
-
consume
public long consume(long subscription)
Consume a subscribed table
-
unsubscribe
public void unsubscribe(long subscription, boolean isKeep)Unsubscribe a table- Parameters:
subscription-
-
validateCreateTableSql
public boolean validateCreateTableSql(String sql)
Validate if a create table sql statement is correct without actually creating that table
-
-