Package com.ocient.jdbc
Class XGConnection
java.lang.Object
com.ocient.jdbc.XGConnection
- All Implemented Interfaces:
AutoCloseable,Connection,Wrapper
public class XGConnection extends Object implements Connection
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXGConnection.ConnectionPoolingModestatic classXGConnection.ConnectionPropertystatic classXGConnection.ConnectionPropertyGroupstatic classXGConnection.HandshakeTypestatic interfaceXGConnection.ResponseHandler<Response>A response handler for response frameprotected static classXGConnection.Sessionstatic classXGConnection.Tlsstatic classXGConnection.XGConnectionFactoryHandles the entire XGConnection lifecycle. -
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
USER_HOME_PATH
-
OKTA_NATIVE_SSO_TOKEN_FILE_NAME
- See Also:
- Constant Field Values
-
OKTA_NATIVE_SSO_TOKEN_FILE_PATH
-
CLIENT_VERSION
-
in
-
out
-
rs
-
warnings
-
url
-
originalIp
-
connectedIp
-
originalPort
protected int originalPort -
connectedPort
protected int connectedPort -
user
-
database
-
client
-
protocolVersion
-
serverVersion
-
oneShotForce
protected boolean oneShotForce -
cmdcomps
-
secondaryInterfaces
-
secondaryIndex
protected int secondaryIndex -
networkTimeout
-
tls
-
sessionID
-
metricsEnabled
protected static volatile boolean metricsEnabled -
pwd
-
session
-
serverSessionId
-
sessionState
protected com.ocient.jdbc.XGConnection.Session.State sessionState -
typeMap
-
properties
-
setSchema
-
setPso
-
maxRows
-
force
protected boolean force
-
-
Method Details
-
refreshSession
- Throws:
SQLException
-
refreshToken
- Throws:
SQLException
-
getConnectionPoolGauges
-
getInfo
-
leaseConnection
Leases a connection to the database specified byinfo. The returned Connection will have hadXGConnection.XGConnectionFactory.activateObject(XGConnectionInfo, PooledObject)called with theinfopassed into this method. IMPORTANT: This is the ONLY way to establish a connection to the database outside of this immediate compilation unit.- Parameters:
info- the XGConnectionInfo object that contains the properties for the connection- Returns:
- an XGConnection object that is either newly created or reused from the pool
- Throws:
Exception- if there is an error retrieving a connection from the poolSQLException
-
forkConnection
public XGConnection forkConnection(XGConnectionInfo.Hint hint, boolean hint_bypassLoadBalancerOnHandshakeOnly) throws SQLExceptionForks a new XGConnection based on the current connection, with optional hints for connection type.- Parameters:
hint- the hint for the type of connection to forkhint_bypassLoadBalancerOnHandshakeOnly- set to true to disable redirect on connect- Returns:
- a new XGConnection object based on the current connection, with the specified properties
- Throws:
Exception- if there is an error creating the new connectionIllegalStateException- if an invalid hint is specifiedSQLException
-
TEST_createConnection
public static XGConnection TEST_createConnection(String user, String pwd, String ip, int portNum, String url, String database, String protocolVersion, XGConnection.Tls tls, CaselessProperties hint_properties) -
abort
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
addTimeout
Schedules the task to run after the specified delay- Parameters:
task- the task to runtimeout- delay in milliseconds
-
setMetrics
public static void setMetrics(boolean enabled) -
clearOneShotForce
public void clearOneShotForce() -
setFatalException
-
clearWarnings
- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException
-
getDefaultOAuthFlow
-
resolveOktaNativeSSOTokenFilePath
-
readOktaNativeSSOToken
public static Optional<OktaAuthenticators.OktaNativeSSOToken> readOktaNativeSSOToken(Path tokenFilePath) throws Exception- Throws:
Exception
-
createOktaNativeSSOToken
public static OktaAuthenticators.OktaNativeSSOToken createOktaNativeSSOToken(ClientWireProtocol.OpenIDAuthenticator authenticator, Properties properties) throws Exception- Throws:
Exception
-
writeOktaNativeSSOToken
public static void writeOktaNativeSSOToken(Path tokenFilePath, OktaAuthenticators.OktaNativeSSOToken token) throws Exception- Throws:
Exception
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException
-
commit
- Specified by:
commitin interfaceConnection- Throws:
SQLException
-
connect
- Throws:
Exception
-
connected
public boolean connected() -
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createBlob
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createClob
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createNClob
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
fetchAuthenticators
Fetches allClientWireProtocol.Authenticators- Returns:
- Throws:
SQLException
-
forceExternal
- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommitin interfaceConnection- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getDB
-
getProperties
-
getHoldability
- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException
-
getMajorVersion
public int getMajorVersion() -
getMetaData
- Specified by:
getMetaDatain interfaceConnection- Throws:
SQLException
-
getMinorVersion
public int getMinorVersion() -
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
getSchemaLocal
-
getServerVersion
-
getTimeoutMillis
protected long getTimeoutMillis() -
getTransactionIsolation
- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMapin interfaceConnection- Throws:
SQLException
-
getURL
-
getUser
-
getVersion
-
getWarnings
- Specified by:
getWarningsin interfaceConnection- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceConnection- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnlyin interfaceConnection- Throws:
SQLException
-
isValid
- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
nativeSQL
- Specified by:
nativeSQLin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String arg0, int arg1, int arg2, int arg3) 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
-
prepareStatement
public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, int arg3) throws SQLException- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
purgeTimeoutTasks
protected void purgeTimeoutTasks()Purges all canceled tasks from the timer.Note: You should only call this if you've canceled a timer. This call may create a
Timerobject if one does not already exist -
reconnect
- Throws:
IOExceptionSQLException
-
reconnect
- Throws:
IOExceptionSQLException
-
redirect
public void redirect(String host, int port, boolean shouldRequestVersion) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
releaseSavepoint
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
sendParameterMessage
- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommitin interfaceConnection- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setParallelism
- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldabilityin interfaceConnection- Throws:
SQLException
-
setMaxRows
-
setMaxRowsHardLimit
- Throws:
SQLException
-
setMaxTempDisk
- Throws:
SQLException
-
setMaxTime
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
setPriority
- Throws:
SQLException
-
setPSOSeed
- Throws:
Exception
-
setPSO
- Throws:
Exception
-
setPSO
- Throws:
Exception
-
setPriorityAdjustFactor
- Throws:
SQLException
-
setServiceClassName
- Throws:
SQLException
-
setMemoryTracing
- Throws:
SQLException
-
setPriorityAdjustTime
- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnlyin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSchema
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
setServerVersion
-
setTimeout
- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
sendRefreshSession
- Throws:
SQLException
-
sendRefreshToken
public com.ocient.jdbc.XGConnection.Session.State sendRefreshToken(com.ocient.jdbc.XGConnection.Session.State oldState) throws SQLException- Throws:
SQLException
-
toString
-