PDA

View Full Version : Auto recover on CLI Communication error



Marco
12-Jul-2005, 06:27 PM
Hi all,

I've got a VDF program that runs continiously with a 5 minute idle
timer, to check, foward and print incoming emails. It is linked to DB2
data using the DataAccess CK.

My issue is the following:
When maintenance needs to be done on the Database server, the
connection of all applications still connected are closed. The VDF
application then reports an 12289 'SQL30081N' error, which basically
is an Communication error. What I would like to happen, is that the
VDF program traps the error, waits a bit and tries again.

I've tried to close and reopen the files, but that is not enough.

Somehow the CLIhandler is closed or something, and I have not found
the way yet to correct the situation so the application continious.

Offcouse when the problem is found, I'd also like to apply this fix to
our Processpooled web applications.

Has anybody have an idea, how to make an application resistant to CLI
connection errors?

Regards,
Marco

Ben Weijers
13-Jul-2005, 04:26 AM
Try logging out. So close all tables, logout, re-open the tables. That
should do the trick.

Regards,

Ben Weijers
Data Access Worldwide

Marco
13-Jul-2005, 07:06 PM
Ben,

I'm getting the following errors:
12294 on the line: Logout "DB2_DRV" "LMSTEST" (Also tried just Logout)
12289 on the line: Open Access
12305 on the line: Call_driver in the SQLFetch function
12305 on the line: Call_Driver in the SQLClose function

Snippets of my test code are:
Procedure Error_Report Integer iErrNum Integer iErrLine String sErrMsg
Showln iErrNum ' ' iErrLine ' ' sErrMsg
If (piErrorHandle(Self)=0) Begin
If ((iErrNum = 12289) And (Pos("SQL30081N",sErrMsg))) Begin
Set piErrorHandle To 1
Showln 'Am going to close all and logout'
Close DF_ALL
Logout "DB2_DRV" "LMSTEST"
Open Access
//RunProgram "CallMeIn5.exe" "idetestrun_marcok"
//Abort
Set piErrorHandle To 0
End
End
End_Procedure
Move Self To Error_Object_ID

Procedure LoadList
Handle hoSQL hDbc hstmt
Integer iFetchResult iItems
String sQuery sFullName
Move "Select full_Name from lms.access order by 1" to sQuery
Send Delete_Data To oList1
Get Create U_cSQLHandleManager To hoSQL
If (hoSQL<>0) Begin
Get SQLFileConnect Of hoSQL ACCESS.File_number To hdbc
If (hDbc <> 0) Begin
Get SQLOpen Of hdbc To hstmt
If (hstmt <> 0) Begin
Send SQLExecDirect Of hstmt sQuery
Repeat
Get SQLFetch Of hstmt To iFetchResult
If (iFetchResult <> 0) Begin
Get SQLColumnValue Of hstmt 1 To sFullName
Send Add_Item To oList1 msg_None sFullName
Increment iItems
End
Until (iFetchResult = 0)
Send SQLClose Of hStmt
End
Send SQLDisconnect Of hdbc
End
Send Destroy to hoSQL
End
Else Send Stop_Box "Unable to create SQLHandler Object"
End_Procedure

Cheers,
Marco Kuipers
South Australia


On Wed, 13 Jul 2005 11:26:45 +0200, "Ben Weijers"
<ben.weijers@dataaccess.nl> wrote:

>Try logging out. So close all tables, logout, re-open the tables. That
>should do the trick.
>
>Regards,
>
> Ben Weijers
> Data Access Worldwide
>

Ben Weijers
14-Jul-2005, 01:45 AM
Hmm, are you sure the logout is sucessful. You could check this using
something like the code below.

Ben Weijers
Data Access Worldwide

Procedure ShowServerList
Integer iNumDrivers
String sDriver
Integer iDriver
Integer iNumServers
String sServer
Integer iServer

Get_Attribute DF_NUMBER_DRIVERS To iNumDrivers
For iDriver From 1 To iNumDrivers
Get_Attribute DF_DRIVER_NAME Of iDriver To sDriver
If (sDriver = "MSSQLDRV") Begin
Showln "Servers for driver " sDriver ":"
Get_Attribute DF_DRIVER_NUMBER_SERVERS Of iDriver ;
To iNumServers
For iServer From 1 To iNumServers
Get_Attribute DF_DRIVER_SERVER_NAME Of iDriver ;
IServer To sServer
Showln " " sServer
Loop
End
Loop
Showln
Showln "Done..."
End_procedure // ShowServerList