ODBC application error

Laura M. Castro <>
Wed Sep 28 13:03:42 CEST 2005


  Hi all,

    We have found a little confusing behaviour concerning the Erlang
ODBC driver. This is a case example: connecting to the (postgresql)
database through ODBC (using the isql utility), we can perform the
following set of commands:

lcastro:~$ isql ourdatabase
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> create table cosa (c1 integer, c2 varchar);
SQLRowCount returns 0

SQL> select * from cosa;
+------------+------------+
| c1         | c2


                                                                   |
+------------+------------+
+------------+------------+
SQLRowCount returns 0

SQL> insert into cosa values (1, 'Hola');
SQLRowCount returns 1

SQL> insert into cosa values (12, 'Holaa');
SQLRowCount returns 1

SQL> insert into cosa values (123, 'Holaaa');
SQLRowCount returns 1

SQL> insert into cosa values (1234, 'Holaaaa');
SQLRowCount returns 1

SQL> insert into cosa values (12345, 'Holaaaaa');
SQLRowCount returns 1

SQL> select * from cosa;
+------------+------------+
| c1         | c2         |
+------------+------------+
| 1          | Hola


                                                                    |
| 12         | Holaa


                                                          |
| 123        | Holaaa     |
| 1234       | Holaaaa


                                                        |
| 12345      | Holaaaaa


                                                       |
+------------+------------+
SQLRowCount returns 5

5 rows fetched
SQL> select * from cosa where c1 = 2;
+------------+------------+
| c1         | c2         |
+------------+------------+
+------------+------------+
SQLRowCount returns 0

SQL> delete from cosa where c1 = 2;
SQLRowCount returns 0



    But if we do the same through the Erlang ODBC driver, have a look at
the result we get:

Eshell V5.4.9  (abort with ^G)
1> application:start(odbc).
ok
2> {ok, C} = odbc:connect("DSN=ourdatabase",[{auto_commit, off},
{timeout, infinity}, {scrollable_cursors, off}, {trace_driver, off},
{tuple_row, off}]).
{ok,<0.42.0>}
3> odbc:sql_query(C, "select * from cosa", infinity).
{selected,["c1","c2"],
          [[1,"Hola"],
           [12,"Holaa"],
           [123,"Holaaa"],
           [1234,"Holaaaa"],
           [12345,"Holaaaaa"]]}
4> odbc:sql_query(C, "select * from cosa where c1=2", infinity).
{selected,["c1","c2"],[]}
5> odbc:sql_query(C, "delete from cosa where c1=2", infinity).
{error,"No SQL-driver information available."}


    What I am trying to show it that I guess the Erlang ODBC driver may
have some kind of problem with those SQL DELETE statements which
eventually do not delete anything :-?

    Any help/comment will be very welcome...

    Thanks in advance,

	Laura Castro

P.S. We were using Erlang R9C-2 but we have also tried with the newest
version, Erlang R10B-7 and the situation remains the same.



More information about the erlang-questions mailing list