[erlang-questions] Erlang ODBC with Postgres

Surindar Sivanesan surindar.shanthi@REDACTED
Tue Jul 15 12:08:53 CEST 2008


Dear Eugen Yu,

In the mail thread, Eduardo has given the solution...
Please go through the following link for more ideas....
http://www.erlang.org/pipermail/erlang-questions/2007-March/025606.html
In my SQL DB, I have used NVARCHAR datatype. This type is not suppotred in
Erlang ODBC. So, I have changed the type to VARCHAR which is supported in
Erlang ODBC. Thus the problem is solved.

Hope this helps.

On Mon, Jul 14, 2008 at 3:59 AM, Eugen Hon Wai Yu <Eugen.Yu@REDACTED>
wrote:

> Hello Surindar,
>
> I have read your thread on the Erlang mailing list.
> You have had some problem accessing a posgresql using the odbc module of
> erlang.
> Can you tell me how you solved the problem?
> I am also trying to use a erlang's odbc module to access data of a postgres
> server.
> There is no problem with the integer however I cannot read string.
> This is what I did:
>
> 1) Create schema
>
> odbc:start(),
> {ok, Ref} = odbc:connect("DSN=MyDataSource", [{scrollable_cursors, off}]),
>  odbc:sql_query(Ref,
>                   "CREATE TABLE EMPLOYEE (NR integer, FIRSTNAME
>  varchar(20), LASTNAME  varchar(20), GENDER char(1),PRIMARY KEY(NR))"),
> odbc:sql_query(Ref, "INSERT INTO EMPLOYEE VALUES(1, 'Jane', 'Doe', 'F')"),
> odbc:stop().
>
> With the squirrel jdbc client I can see that the schema has been created
> and there is one row in it.
>
> 2) Now I try to read the data
>
> odbc:start(),
> {ok, Ref} = odbc:connect("DSN=MyDataSource", [{scrollable_cursors, off}]),
> X = odbc:sql_query(Ref, "SELECT FIRSTNAME FROM EMPLOYEE"),
> odbc:disconnect(Ref),
> odbc:stop(),
> X.
>
> And I get is the infamous error:
>  {error,"Column type not supported"}
> With the NR column there is no problem, but the other three columns return
> the same error message.
> Can you tell me how you have solved the problem?
>
> Alternatively please tell me if you know any other methods to access a
> posgresql database.
> Thanks for your attention.
> Best regards
> - Eugen Yu
>
>


-- 
Thanks & Regards,
S.Surindar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080715/8577e119/attachment.htm>


More information about the erlang-questions mailing list