Package com.j_spaces.jdbc.driver
Class GConnection
java.lang.Object
com.j_spaces.jdbc.driver.GConnection
- All Implemented Interfaces:
AutoCloseable,Connection,Wrapper
The connection implementation that connects to the QueryProcessor on the GigaSpaces server side.
Note: This implementation is NOT thread-safe. Do not share instances between threads!
- Author:
- Michael Mitrani, 2Train4, yuval mishory
-
Field Summary
FieldsFields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGConnection(IJSpace space, Properties properties) GConnection(String connectionString, Properties properties) Create new connection from given connection string and properties -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidclose()voidcommit()connect()createArrayOf(String typeName, Object[] elements) createBlob(byte[] bytes) createClob(String clob) createStatement(int resultSetType, int resultSetConcurrency) createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) createStruct(String typeName, Object[] attributes) booleangetClientInfo(String name) intstatic GConnectiongetInstance(IJSpace space) static ConnectiongetInstance(IJSpace space, String username, String password) static GConnectiongetInstance(IJSpace space, Properties properties) intgetTableColumnsInformation(String tableName) Returns a ResultSet containing columns information for the provided table name.intgetUrl()booleanisClosed()booleanbooleanisValid(int timeout) booleanisWrapperFor(Class<?> iface) prepareCall(String sql) prepareCall(String sql, int resultSetType, int resultSetConcurrency) prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String sql) prepareStatement(String sql, int autoGeneratedKeys) prepareStatement(String sql, int[] columnIndexes) prepareStatement(String sql, int resultSetType, int resultSetConcurrency) prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String sql, String[] columnNames) voidreleaseSavepoint(Savepoint savepoint) voidrollback()voidsendFetchMetaData(String statement) sendPreparedStatement(String statement, Object[] values) Send a packet that contains a PreparedStatement.sendPreparedStatementBatch(String statement, GPreparedStatement.PreparedValuesCollection preparedValuesCollection) Send a packet that contains a PreparedStatement values batch.sendStatement(String statement) Send a packet that contains a statement.voidsetAutoCommit(boolean autoCommit) voidsetCatalog(String catalog) voidsetClientInfo(String name, String value) voidsetClientInfo(Properties properties) voidsetHoldability(int holdability) voidsetNetworkTimeout(Executor executor, int milliseconds) voidsetReadOnly(boolean readOnly) setSavepoint(String name) voidvoidsetTransaction(Transaction transaction) Sets the transaction the connection will use.voidsetTransactionIsolation(int level) voidsetTypeMap(Map<String, Class<?>> map) voidsetUseSingleSpace(boolean useSingleSpace) <T> Tbooleanprotected StringvalidateAndGetSpaceUrl(String connectionString) writeRequestPacket(RequestPacket packet) This is the methods that writes the RequestPacket into the socketMethods 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, setShardingKeyIfValid
-
Field Details
-
READ_MODIFIERS
- See Also:
-
JDBC_GIGASPACES
- See Also:
-
JDBC_GIGASPACES_URL
- See Also:
-
-
Constructor Details
-
GConnection
- Throws:
SQLException
-
GConnection
Create new connection from given connection string and properties
-
-
Method Details
-
validateAndGetSpaceUrl
- Throws:
SQLException
-
connect
- Throws:
SQLException
-
getInstance
- Throws:
SQLException
-
getInstance
- Throws:
SQLException
-
getInstance
public static Connection getInstance(IJSpace space, String username, String password) throws SQLException - Throws:
SQLException
-
setTransaction
Sets the transaction the connection will use. Only relevant when auto commit is set to false.- Parameters:
transaction- The transaction the connection will use.- Throws:
SQLException
-
getTableColumnsInformation
Returns a ResultSet containing columns information for the provided table name.- Parameters:
tableName- The table to get columns information for.- Returns:
- ResultSet containing columns informations.
- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException
-
commit
- Specified by:
commitin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommitin interfaceConnection- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceConnection- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnlyin interfaceConnection- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldabilityin interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommitin interfaceConnection- Throws:
SQLException
-
setUseSingleSpace
- Parameters:
useSingleSpace- to use single space- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnlyin interfaceConnection- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaDatain interfaceConnection- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMapin interfaceConnection- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
nativeSQL
- Specified by:
nativeSQLin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCallin 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
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
writeRequestPacket
This is the methods that writes the RequestPacket into the socket- Parameters:
packet- the RequestPacket to send- Returns:
- ResponsePacket The packet returned from the QueryProcessor
- Throws:
SQLException
-
createBlob
- Throws:
SQLException
-
createClob
- Throws:
SQLException
-
sendStatement
Send a packet that contains a statement.- Parameters:
statement- the sql statement that should be sent- Returns:
- The ResponsePacket received from the QueryProcessor
- Throws:
SQLException
-
sendPreparedStatement
Send a packet that contains a PreparedStatement.- Parameters:
statement- the SQL statement that should be sent.- Returns:
- The ResponsePacket received from the QueryProcessor
- Throws:
SQLException
-
sendPreparedStatementBatch
public BatchResponsePacket sendPreparedStatementBatch(String statement, GPreparedStatement.PreparedValuesCollection preparedValuesCollection) throws SQLException Send a packet that contains a PreparedStatement values batch.- Throws:
SQLException
-
sendFetchMetaData
- Throws:
SQLException
-
getUrl
- Returns:
- the url of this connection
-
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createBlob
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createClob
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
isValid
- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
createNClob
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setSchema
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
abort
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
useNewDriver
public boolean useNewDriver()
-