Timeout for dbExecuteCommand()

Find and share HowTos to various installations / configurations!
1 post • Page 1 of 1
treshnikov
Posts:16
Joined: Tue Nov 12, 2013 7:11 am

Timeout for dbExecuteCommand()

Post by treshnikov »

Hello there!

I have the next problem case:
* Need to read values from Oracle database and write them into datapoints
* I use dbOpenConnection() and dbExecuteCommand() commands
* The problem is that after 30 seconds of execution occurs error with messages

WCCOAui7:["Errornumber : -2147217871"]
WCCOAui7:["BaseError : 1013"]
WCCOAui7:["Description : [Oracle][ODBC][Ora]ORA-01013: user requested cancel of current operation
WCCOAui7:"]
WCCOAui7:["SQL-errortext: S1T00"]

The question is - how to increase timeout for command execution for dbExecuteCommand() function?

If try to run SQL command in IDE (dbForge, for example) - the command will executed successfully for 1 min and 30 sec.

Code of test panel is below:

Code: Select all

#uses "ctrlADO"

string connectionString = "DSN=AIISKUE;UID=S1;PWD=S1;";

main()
{
    dbConnection connection;  
    if(OpenDbConnection(connection))
    {  
      string sqlQueryString2 = "SELECT bvi.N_FID, bvi.N_GR_TY, bvi.N_INTER_RAS, bvi.VAL FROM CNT.BUF_V_INT bvi WHERE bvi.N_FID = 101 AND bvi.DD_MM_YYYY = TO_DATE('09.11.2015', 'dd.mm.yyyy')";      
      dbCommand dbCmd;
      dbRecordset rs;
      int res = 0;
       
      dbStartCommand(connection, sqlQueryString2, dbCmd);      
      if(res != 0)
      {
          DebugLastError(connection);
      }     
      else
      {
          DebugTN("START EXEC");
      
          res = dbExecuteCommand(dbCmd, rs);
          if(res != 0)
          {
            DebugTN("EXEC ERROR");
            DebugLastError(connection);
          }      
          else
          {
            while(!res  && !dbEOF(rs))
            {     
              res = dbMoveNext(rs); 
            }
            DebugTN("DONE");
            
            if(res)
            {        
              dbCloseRecordset(rs);       
            }
        }
      }
    }
    CloseDbConnection(connection);
    
}

private void DebugLastError(dbConnection connection)
{
    int errCnt, errNo, errNative;
    string errDescr, errSql;
    dbGetError (connection, errCnt, errNo, errNative, errDescr, errSql);
 
    DebugN("Errornumber : " + errNo);
    DebugN("BaseError : " + errNative);
    DebugN("Description : " + errDescr);
    DebugN("SQL-errortext: " + errSql);       
}

private bool OpenDbConnection(dbConnection& connection)
{
    int resOpenConnection = dbOpenConnection(connectionString, connection);
    if(resOpenConnection != 0)
    {
      DebugLastError(connection);
      return false;
    }
    return true;
}

private bool CloseDbConnection(dbConnection& connection)
{
    int resCloseConnection = dbCloseConnection(connection);
    if(resCloseConnection != 0)
    {
      DebugLastError(connection);
      return false;
    }
    return true;
}

1 post • Page 1 of 1