- This topic has 4 replies, 2 voices, and was last updated 14 years, 10 months ago by .
-
Topic
-
I’ connecting to a database in the start mode of a switch statment. Cloverleaf executes the start mode only while initiallizing/starting the concerned thread.
I need to check the connectivity in the run mode and if the connectivity is lost, I need to reconnect from the run mode.
Can anyone help me in this?
The code for connecting in the start mode is quite simple:
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
global logon_handle stmt_enc_handle stmt_pat_handle sql_encounter
sql_patient
global stmt_pat_del_handle stmt_enc_del_handle stmt_pat_fileid_handle
# Connecting to Database
set logon_handle [oralogon $db_id/$db_pw@$db_cs]
set stmt_enc_handle [oraopen $logon_handle]
set stmt_pat_handle [oraopen $logon_handle]
set stmt_pat_del_handle [oraopen $logon_handle]
set stmt_enc_del_handle [oraopen $logon_handle]
set stmt_pat_fileid_handle [oraopen $logon_handle]
}
The reson I’m connecting in the start mode and not in the run mode is becuase I don’t want to recreate a session/connection for each message if the connection is valid. I need to check the status of the connection with each message and re-connect only if required/disconnected before sending that message in the run mode.
Thanks
Yasir
- The forum ‘Tcl Library’ is closed to new topics and replies.