Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  ODBC Mac OSX 10.5 MySQL

justinP
Posted: Fri Mar 20, 2009 9:47 am Reply with quote
Joined: 20 Mar 2009 Posts: 1 Location: Uppsala
I didn't have much luck on the mailing list. So I'll try here.

I'm trying to connect MySQL to Erlang on a Mac with 10.5.
I installed MySQL and the ODBC driver from the binary installer on MySQL's website. I've installed the latest erlang R13A from source. I ran configure with --with-odbc

When I start MySQL I have an ODBC DNS myodbc running called myodbc which I can connect via openoffice so it seems alive.

When I try to use erlang I get the following.
Eshell V5.6.5 (abort with ^G)
1> odbc:start().
ok
2> odbc:connect("DSN=myodbc;UID=justin;Password=xxxx",[]).

=ERROR REPORT==== 20-Mar-2009::10:39:44 ===
ODBC: received unexpected info: {tcp_closed,#Port<0.528>}


=ERROR REPORT==== 20-Mar-2009::10:39:44 ===
** Generic server <0.37.0> terminating
** Last message in was {#Port<0.526>,{exit_status,138}}
** When Server state == {state,#Port<0.526>,
{<0.30.0>,#Ref<0.0.0.39>},
<0.30.0>,undefined,on,undefined,undefined,on,
connecting,undefined,0,
[#Port<0.524>,#Port<0.525>],
#Port<0.527>,#Port<0.528>}
** Reason for termination ==
** {port_exit,killed}
{error,connection_closed}

I also get the same error when I try
odbc:connect("somerandomstring",[]).
So I think that there might be some fundamental problem.

Any suggestions?
I'm willing to get my hands dirty, so any suggestions as where to look would be helpful.


Justin

P.S. The reply that I can us other libraries to connect to MySQL, while it is true, is not really that helpful in this case.
View user's profile Send private message Send e-mail
ostinelli
Posted: Thu Jun 04, 2009 4:05 pm Reply with quote
Joined: 21 Dec 2008 Posts: 3
hi, i'm having the exact same problems as you. do you happen to have solved this meanwhile?

cheers,

r.
View user's profile Send private message
pegesund
Posted: Sun May 09, 2010 6:25 pm Reply with quote
Joined: 09 May 2010 Posts: 5
Hi, it seems to be a long living bug!

You can fix it by changing the file odbcserver.c (just add the two remark-lines) like below, and recompile erlang from source (the usual: sudo make && sudo make install).

Don't worry about loosing the settings, these can be chosen from the Mac-gui.

In the long run someone should fix it by checking on platform in the erlang repository itself. Anybody know how to send in patches?

Cheers,

Petter Egesund



-- Fix ---


/* rem out to fix connection bug
if(!sql_success(SQLSetConnectAttr(connection_handle(state),
SQL_ATTR_CONNECTION_TIMEOUT,
(SQLPOINTER)TIME_OUT, 100)))
DO_EXIT(EXIT_CONNECTION);
fprintf(stderr, "Petter: setting handle values 5 \n");
if(!sql_success(SQLSetConnectAttr(connection_handle(state),
SQL_ATTR_AUTOCOMMIT,
(SQLPOINTER)auto_commit_mode, 0)))
DO_EXIT(EXIT_CONNECTION);

if(!sql_success(SQLSetConnectAttr(connection_handle(state),
SQL_ATTR_TRACE,
(SQLPOINTER)trace_driver, 0)))
DO_EXIT(EXIT_CONNECTION);
end of rem out */
View user's profile Send private message
Jacob
Posted: Fri Aug 12, 2011 1:29 pm Reply with quote
Joined: 12 Aug 2011 Posts: 1
I am trying to use odbc to connect to a mysql database on Mac OSX 10.5. How can i did it?
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum