Вопрос

I've got an Oracle OCI program, which is in production on various platforms: SLES Linux, Ubuntu, AIX, Solaris and HP-UX. I'm trying to get the same thing running on Redhat, and I'm having difficulties.

The problem seems to arise when using a scrollable cursor (calling OCIStmtExecute with OCI_STMT_SCROLLABLE_READONLY), and using a function that does a binary search to get the exact result set size. More generically, the problem seems to be reading past the end of the result set, before reading an OK value.

I have written a test utility which executes a simple statement that must return 1 row (SELECT COUNT(*) FROM xxx). It then retrieves data from the result set:

If I first retrieve row 1, it works fine. If I then go past the end of the result set, it continues to work fine when I return. But if my first check is after the result set, everything goes wrong:

> rdb_test 1
12:06:32.365 Checking row 1 - OK

> rdb_test 3
12:06:35.510 Checking row 3 - NO DATA
12:06:35.511 Checking row 2 - NO DATA
12:06:45.549 Checking row 1 - NO DATA

> rdb_test -3
12:06:49.344 Checking row 1 - OK
12:06:49.344 Checking row 3 - NO DATA
12:06:49.345 Checking row 2 - NO DATA
12:06:49.345 Checking row 1 - OK

Also there is a strange delay, 10s in the example above, while it retrieves the row which should be OK. In the debugger, this is deep within the OCIStmtFetch2 function - unsurprisingly in the __read_nocancel function waiting for the server response.

Has anyone else seen this problem before?

Это было полезно?

Решение

The problem seems to be related to the version 11 OCI library. I have just tried the v10 library, and it seems to work OK again with that. Unfortunately, that requires an old version of the C++ standard library, so I would still prefer to avoid this fix if an alternative is available.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top