ODBC application error
Michael McDaniel
erlang@REDACTED
Wed Sep 28 17:16:05 CEST 2005
Do you have the UID and PWD embedded in your ODBC files?
And the UID has been GRANTed delete permissions to database?
I do my odbc:connect similar to ...
1> application:start(odbc).
ok
2> {ok,Ref} = odbc:connect("DSN=myodbc3;UID=test;PWD=test",
[{trace_driver,on}]).
{ok, <lt0.38.0>}
3> q().
$
Maybe it makes a difference if UID/PWD is in odbc:connect call rather
than ODBC files. I do not know, maybe worth trying.
~Michael
On Wed, Sep 28, 2005 at 01:03:42PM +0200, Laura M. Castro wrote:
>
> 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.
--
Michael McDaniel
Portland, Oregon, USA
http://autosys.us
+1 503 283 5284
More information about the erlang-questions
mailing list