Tuesday 29 July 2014

Stress test ODBC

I had a client that was having all sorts of instability from their RFGen machine.  Yes, I don’t generally promote or talk about other vendors, but RFGen essentially acts like a fat conduit for BSFN’s for RF guns – easy.  It treats the fat client as a mechanism for running BSFNs, easy too.

This one client was having a function die every night / two nights / four nights.

We enabled logging and found that the error was occurring at random statements, sometimes update, delete, insert or open connection.  So, we also found that the AS/400 was getting TCP2617 when we were getting the ODBC problems, so the AS/400 did not hear anything from the connection and terminated it, this is when the client also gave up.

Wow… So, we needed to devise a way so that JD Edwards was not to blame, sure we kinda knew that because the errors were all occurring in ODBC statements – but the client wanted proof (of course!!)

This is a vbscript, just cut and paste it into a .vbs extension and run it with the 32bit wscript executable.  This just stresses ODBC a little.  What I found was that this would break after about 50 executions on particular machines.

This all came down to incorrect routing on the AS/400 – but what an adventure it was!

  dateStamp=now
  fileSuffix=Left(FormatDateTime(dateStamp, 1),6) & day(dateStamp) & monthName(month(dateStamp))  & hour(dateStamp)
  Const ForAppending = 8
  logfile="c:\temp\" & fileSuffix & ".txt"
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  set objTextFile = objFSO.OpenTextFile(logfile, ForAppending, True)

j=2
while j > 1
Dim Oracon
set oraccon = wscript.createobject("ADODB.Connection")
Dim recset
set recset = wscript.createobject("ADODB.Recordset")
Dim cmd
set cmd = wscript.createobject("ADODB.Command")
Set Oracon = wscript.CreateObject("ADODB.Connection")

Oracon.ConnectionString = "DSN=Business Data - CRP;" & _
                          "User ID=ONEWORLD;" & _
                          "Password=somethingSecret;"

Oracon.Open
Set cmd.ActiveConnection = Oracon
cmd.CommandText = "Select * from crpdta/f0101"
Set recset = cmd.Execute
i=0
while i < 20
  for each field in recset.fields
    tuple=tuple & " " & field.value
  next
  i=i+1
  recset.MoveNext
'  wscript.echo tuple
  tuple=" "
wend


set recset = nothing
oracon.close
set oracon = nothing

j=j+1


  objTextFile.WriteLine(j)

wend

No comments: