ODBC connection fails

Ingela Anderton ingela@REDACTED
Fri Sep 12 16:49:45 CEST 2003

Vlad Dumitrescu wrote:

> Should odbc:first and friends work even without scrollable cursors? From the
> documentation, it would seem thet they should work (forward only), but I only
> get an "{error, scrollable_cursors_disabled}". Is this right?
Yes it is right!
The functions first/[1,2], last/[1,2], prev[1,2] and select/[3,4]
where the position argument is one of {relative, Pos} | {absolute,
Pos} are all implemented using scrollable cursors.

Also stated in the documentation:

"Alas some drivers only support sequential traversal of the result
set, e.i. they do not support what in the ODBC world is known as
scrollable cursors. This will have the effect that functions such as
first/[1,2], last/[1,2], prev[1,2], etc may return {error,

Description of select_count from the man page:

Executes a SQL SELECT query and associates the result set with the
connection. A cursor is positioned before the first row in the result
set and the tuple {ok, NrRows} is returned.

E.i. calling next will give you the first row of the result set and
then you can keep traversing the resut set sequentially by calling
next until you reach the end of the result set. You can also use
select/[3,4] with postion next if you want to get for instance
the 10 next rows. 

Also if you look at the man page for the function first and see
what are the possible error reasons you will see:

Reason = result_set_does_not_exist | driver_does_not_support_function
| scrollable_cursors_disabled | process_not_owner_of_odbc_connection |

See common data types. 

So you can't say it was not documented ;)


Ericsson AB - OTP team

More information about the erlang-questions mailing list