public class SessionConnection
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected DBService |
dBService |
protected java.lang.String |
m_ip |
protected java.lang.String |
m_port |
protected int |
m_sequence |
protected java.lang.String |
m_session |
protected java.lang.String |
sdsName |
Constructor and Description |
---|
SessionConnection(DBService service,
java.lang.String session,
int sequence)
Constructor.
|
SessionConnection(DBService service,
java.lang.String session,
int sequence,
java.lang.String name)
Constructor.
|
SessionConnection(DBService service,
java.lang.String ip,
java.lang.String port,
java.lang.String session,
int sequence) |
SessionConnection(DBService service,
java.lang.String ip,
java.lang.String port,
java.lang.String session,
int sequence,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection
|
void |
commit()
Make commit on the connection
|
java.util.Map |
executeStoredProcedure(java.lang.String storedProcedureName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> params,
java.lang.String returnType) |
java.util.HashMap |
getConfig()
Get the configuration of SessionConnection
|
java.lang.String |
getIp() |
java.lang.String |
getPort() |
int |
getSequence() |
java.lang.String |
getSessionId() |
java.util.Vector |
loadValue(java.lang.String sqlcmd)
Invoke the connection to load value.
|
java.util.Vector |
loadValue(java.lang.String sqlcmd,
java.lang.Object[] args)
Invoke the connection to load value with
java.sql.PreparedStatement . |
void |
rollback()
Make rollback on the connection
|
void |
setDBService(DBService dBService) |
java.lang.String |
toString() |
boolean |
updateValue(java.lang.String sqlcmd)
Invoke the connection to update value.
|
boolean |
updateValue(java.lang.String sqlcmd,
java.lang.Object[] args)
Invoke the connection to update value with
java.sql.PreparedStatement . |
protected transient DBService dBService
protected java.lang.String m_session
protected int m_sequence
protected java.lang.String m_ip
protected java.lang.String m_port
protected java.lang.String sdsName
public SessionConnection(DBService service, java.lang.String session, int sequence)
SessionConnection
with the specified parameters.service
- the given remote DBServicesession
- the given session keysequence
- the given data source sequencepublic SessionConnection(DBService service, java.lang.String ip, java.lang.String port, java.lang.String session, int sequence)
public SessionConnection(DBService service, java.lang.String session, int sequence, java.lang.String name)
SessionConnection
with the specified parameters.service
- the given remote DBServicesession
- the given session keysequence
- the given data source sequencename
- the given SessionDataSource namepublic SessionConnection(DBService service, java.lang.String ip, java.lang.String port, java.lang.String session, int sequence, java.lang.String name)
public void close() throws java.lang.Exception
java.lang.Exception
- exception occurs if server can not close session
connectionpublic java.util.Vector loadValue(java.lang.String sqlcmd) throws java.lang.Exception
Notes: In Agentflow 4.0, server.properties add a LoadValueExceptionCauseTaskRollback attribute to control rollback when loadValue has failure. Default value is true. When value is true and loadValue has failure, it would cause a task rollback (ex. fail to start a process), even if the script uses try...catch to deal with this error or add the connection to Transaction Manager, it still follows this rule. When value is false and loadValue has failure, it would not cause a task rollback.
sqlcmd
- the given sql commandVector
is instance of
ResultTable
)java.lang.Exception
- exception occurs if the server can not load value with
session connectionResultTable
public java.util.Vector loadValue(java.lang.String sqlcmd, java.lang.Object[] args) throws java.lang.Exception
java.sql.PreparedStatement
.sqlcmd
- the given sql commandargs
- args array with values to pass to the sqlVector
is instance of
ResultTable
)java.lang.Exception
- exception occurs if the server can not load value with
session connectionResultTable
public boolean updateValue(java.lang.String sqlcmd) throws java.lang.Exception
Notes: In Agentflow 4.0, when updateValue has failure, it would not cause a task rollback.
sqlcmd
- the given sql commandjava.lang.Exception
- exception occurs if the server can not update value with
session connectionpublic boolean updateValue(java.lang.String sqlcmd, java.lang.Object[] args) throws java.lang.Exception
java.sql.PreparedStatement
.sqlcmd
- the given sql commandargs
- args array with values to pass to the sqljava.lang.Exception
- exception occurs if the server can not update value with
session connectionpublic void commit() throws java.lang.Exception
java.lang.Exception
public void rollback()
public java.util.HashMap getConfig() throws java.lang.Exception
java.lang.Exception
- exception occurs if the server can not get the config of
the session connectionpublic java.lang.String getSessionId()
public int getSequence()
public java.lang.String getIp()
public java.lang.String getPort()
public void setDBService(DBService dBService)
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Map executeStoredProcedure(java.lang.String storedProcedureName, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> params, java.lang.String returnType) throws java.lang.Exception
java.lang.Exception
Copyright ? 2022. All Rights Reserved.