[erlang-questions] Erlang and MySQL: ODBC, Column type not supported

Hanfei Shen qqshfox@REDACTED
Mon May 2 10:21:18 CEST 2011


Hi Parnell,

    The module which you recommended does work correctly, but I wonder
why erlang odbc/MyODBC does not support such a common column type...

    Thank you very much indeed.


2011/5/2 Parnell Springmeyer <ixmatus@REDACTED>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I would recommend using dizzyd's MySQL module:
>
> https://github.com/dizzyd/erlang-mysql-driver
>
> It works very well for me!
>
> Hanfei Shen <qqshfox@REDACTED> writes:
>
>> Dear all,
>>
>> I'm a newbie programming in erlang. When I used ODBC to connect to a
>> MySQL database through Connector/ODBC (MyODBC), I got some error when
>> calling odbc:sql_query(Conn, "SELECT * FROM action"):
>>
>> {error,"Column type not supported"}
>>
>> Then I call odbc:describe_table(Conn, "action"), it returned:
>>
>> {ok,[{"id",sql_integer},
>>      {"code",'ODBC_UNSUPPORTED_TYPE'},
>>      {"compliment_desc",'ODBC_UNSUPPORTED_TYPE'},
>>      {"status_desc",'ODBC_UNSUPPORTED_TYPE'},
>>      {"parameter",'ODBC_UNSUPPORTED_TYPE'},
>>      {"cause",'ODBC_UNSUPPORTED_TYPE'},
>>      {"disabled",sql_tinyint}]}
>>
>> And desc the table in mysql client:
>> mysql> desc action;
>> +-----------------+--------------+------+-----+---------+----------------+
>> | Field           | Type         | Null | Key | Default | Extra          |
>> +-----------------+--------------+------+-----+---------+----------------+
>> | id              | int(11)      | NO   | PRI | NULL    | auto_increment |
>> | code            | varchar(255) | NO   |     | NULL    |                |
>> | compliment_desc | varchar(255) | NO   |     |         |                |
>> | status_desc     | varchar(255) | NO   |     |         |                |
>> | parameter       | varchar(255) | NO   |     |         |                |
>> | cause           | varchar(255) | NO   | UNI |         |                |
>> | disabled        | tinyint(1)   | NO   |     | 0       |                |
>> +-----------------+--------------+------+-----+---------+----------------+
>>
>> It seems that Erlang ODBC driver does not support the mysql type
>> varchar? How can I use the database without touching the db schema?
>>
>>
>> Some details about the system env:
>>
>> $ uname -a
>> Linux 2.6.36-gentoo-r8 #4 SMP Thu Apr 7 20:13:18 CST 2011 x86_64
>> Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz GenuineIntel GNU/Linux
>>
>> $ erl
>> Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:2:2] [rq:2]
>> [async-threads:0] [kernel-poll:false]
>>
>> $ emerge -vp erlang
>> dev-lang/erlang-13.2.4  USE="doc kpoll odbc smp ssl -emacs -hipe -java
>> -sctp -tk -wxwidgets"
>>
>> eshell> code:which(odbc).
>> "/usr/lib64/erlang/lib/odbc-2.10.7/ebin/odbc.beam"
>>
>> $ mysql -V
>> mysql  Ver 14.14 Distrib 5.1.51, for pc-linux-gnu (x86_64) using readline 5.1
>>
>> Server version: 5.1.51-log Gentoo Linux mysql-5.1.51
>>
>> $ emerge -vp myodbc
>> dev-db/myodbc-5.1.6  USE="-debug -doc -qt4 -static"
>>
>>
>> Any help will be greatly appreciated.  Thanks in advance.
>> Sorry for my poor English, I'm not a native...
>>
>> Best,
>>
>> --
>> Hanfei
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
> - --
> Parnell "ixmatus" Springmeyer (http://ixmat.us)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
>
> iQEcBAEBAgAGBQJNvZ9BAAoJEPvtlbpI1POLn3gH/3WPPtfTUSdtEdGCI/kg0Gj9
> BOB4vLBId+s5BpFPcm90ZBCkUZccKqT6LTCxMLBZ99w8hlIGXPKafCVO5AMDCZeC
> /2ZMPW2xHHfseixtYjATj5XG7/6SR1cTsrVhjxvdOPnFNxSXDcW4eZTbJYTWf8Es
> jSZE6hDTg4DoHLOvOc3UeSw8QiBmLD1nFB0EQM/dcTHuGifygDXztr/0TBBr5VHq
> yjd2V1BMW0WeSFrHT+mAO8Oh+gtleh0N06R1a5EMCtBDIGmrmy56DciQQirdAjbT
> NXlpYjHXCbjka1KM0/ov9UWIgw6fhs9EsrKgXpD8pBw0cnYq2Hs7oy5v0M+A0BQ=
> =Pm6l
> -----END PGP SIGNATURE-----
>



More information about the erlang-questions mailing list