cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

When using ODBC driver from ASA version 17, SQL requests with errors in data doesn't set some error indication ( sqlcode and sqlstate are both 0 ), so client gets just some part of data without warning about error. Drivers from previous versions ( tested ASA 12 and 16 ) sets error code.

ISQL also shows error, but it doesn't use ODBC, so I suspect something in ODBC driver.

Client is Powerbuilder, same behavior for all latest versions. Also tested on different engines ( 12,16,17 ), no differences here.

Errors are usually dividing by zero or subselect which returns more than one row ...

Example with divide by zero error:

SELECT Row_Num as A,
       Mod(A,10) as B,
       A / B as C
  FROM sa_Rowgenerator( 1, 20 );

Or:

SELECT 10 / 0 as X FROM Dummy;

Is there any settings in connection parameters or other which applys to this behavior ?

View Entire Topic
Breck_Carter
Participant
0 Likes

Try using the SQL Anywhere 16 ODBC driver instead of SQL Anywhere 17.

( there is no planet on which SQL_SUCCESS_WITH_INFO makes sense for divide by zero 🙂

SQLCA.DBMS = 'ODB'
SQLCA.DBParm &
   = "ConnectString='Driver=SQL Anywhere 16;UID=dba;PWD=sql;ENG=inventory17_xps;DBN=inventory17;'," &
   + "ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'"
CONNECT USING SQLCA;
IF SQLCA.SQLCODE <> 0 THEN
    MessageBox ( 'Error', &
        'CONNECT 1 failed in open:' &
        + '~r~nSQLCode = ' &
        + String ( SQLCA.SQLCode ) &
        + '~r~nSQLDBCode = ' &
        + String ( SQLCA.SQLDBCode ) &
        + '~r~n' &
        + SQLCA.SQLErrText )
    RETURN
END IF
  • Using older drivers is not an option, most of our clients have license for ver 17 ...

  • divide_by_zero_error , SuppressWarnings, PrefetchOnOpen ... no difference

( this is not limited to division by zero, but any errors related to processing rows, like casting errors, subselect which returns more than one row and similar errors )

Like:

SELECT Row_Num as A,
       if A=10 then cast('A' as integer) endif as B
  FROM sa_Rowgenerator( 1, 20 );

This are just examples to demonstrate the problem. In reality we write SQL which avoids such errors, related to data, by testing '<> 0' when dividing or using SELECT FIRST on subselects and testing data before casting. But with many statements sometimes something slips or is not so obvious, and in this cases I want to see and respond to error, not just get some rows with no indication that something went wrong.

Breck_Carter
Participant
0 Likes

What version and build of PowerBuilder are you using?

Do you know if any different version(s)/build(s) of PB behave differently with SQL Anywhere 17?

Breck_Carter
Participant
0 Likes

> our clients have license for ver 17

You should contact SAP tech support. Most folks on this forum are non-SAP volunteers with no access to the internal workings of SQL Anywhere.

0 Likes

We have latest version, 2019 R3. I tested some versions from 2017 ... no difference.

Yes, I know. I'll try at SAP and Appeon. My resume is that both are involved in this, SAP has changed return status from fetch call on error, Appeon ( Powerbuilder ) has not correctly tested this status. SAP ISQL and some other SQL clients I tested reported error on this example. We'll see.

Thanks for help.