[erlang-questions] Installing mysql driver

Paul Johnston <>
Tue Apr 13 15:12:41 CEST 2010


Thanks!

I sorted of worked it out by creating a directory 
:_snv_134:/usr/local/lib/erlang/lib/mysql$
compiled the erl files from svn into there.
then:

-module(application1).
-export([start/0,ending/0]).


start() -> hello.

ending() -> mysql:start_link(p1,"127.0.0.1", "erlang_db",
"password","erlang"),
	Result1 = mysql:fetch(p1,"SELECT id, forename  FROM users"),
	io:format("Result1: ~p~n", [Result1]).

Gives me

2> application1:ending().
mysql_conn:620: greeting version "5.1.37" (protocol 10) salt "QkG`.b$*"
caps 63487 serverchar <<8,2,0,0,
 
0,0,0,0,
 
0,0,0,0,
 
0,0,0,0>>salt2 "GfM/?1v!>UnJ"
mysql_auth:187: mysql_auth send packet 1:
<<5,162,0,0,64,66,15,0,8,0,0,0,0,0,0,
 
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 
101,114,108,97,110,103,95,100,98,0,
 
20,67,112,50,212,246,137,195,223,
 
208,18,41,186,105,119,91,178,5,121,
                                            78,126>>
mysql_conn:426: fetch <<"use erlang">> (id <0.85.0>)
mysql_conn:426: fetch <<"SELECT id, forename  FROM users">> (id
<0.85.0>)
Result1: {data,{mysql_result,[{<<"users">>,<<"id">>,11,'LONG'},
                              {<<"users">>,<<"forename">>,10,'STRING'}],
                             [[1,<<"Paul">>]],
                             0,[]}}
Ok

The code is dated 12 Sept 2005 and is written by your good self :-)
Just to say thanks for all the work you put into something like this so
I can have a play around!

Paul



-----Original Message-----
From:  [mailto:]
On Behalf Of Fredrik Thulin
Sent: 13 April 2010 12:28
To: Johnston, Paul
Cc: 
Subject: Re: [erlang-questions] Installing mysql driver

On Tue, 2010-04-13 at 11:30 +0100, Paul Johnston wrote:
> Hi
> 
> Can anyone give any hints on installing the mysql drivers for erlang.
> 
> I've got the files from svn checkout
> http://erlang-mysql-driver.googlecode.com/svn/trunk but there are no
> installation instructions (I'm using OpenSolaris).
> 
> TIA Paul

It isn't really a driver, it is more of a client that you can use from a
program you write. Thus you can't install it separately somewhere and
expect different programs to find it.

Look at YXA for example (where that code comes from originally). YXA has
the mysql directory as /src/mysql here

  http://github.com/fredrikt/yxa/tree/master/src/mysql/

and the code is called from here

http://github.com/fredrikt/yxa/blob/master/src/sipuserdb/sipuserdb_mysql
.erl

/Fredrik



________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:



More information about the erlang-questions mailing list