Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  yaws, erlang, mysql

Seb
Posted: Thu Sep 03, 2009 9:07 pm Reply with quote
Joined: 10 Mar 2008 Posts: 5 Location: Canada
Hi,
This should be super easy :
I have a YAWS server and a MySQL server running under Ubuntu. I want to establish a connection from an erlang-html page to the MySQL server. Here's what I have:

Code:
<html>
<erl>
application:start(odbc).
ConnString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=test; User=root;Password=ace152;Option=3;".
{ok, Conn} = odbc:connect(ConnString, []).
Results = odbc:sql_query(Conn, "SELECT * FROM test_table").
out(A)->{html,"Something here."}.
</erl>
</htmL>

[/code]


So, Why doesn't this work ? Any ideas ?




Post received from mailinglist
View user's profile Send private message
Guest
Posted: Thu Sep 03, 2009 10:10 pm Reply with quote
Guest
It is hard to tell what the problem is without some form of error message to show where the failure is, but this could be a number of things.
Seb
Posted: Thu Sep 03, 2009 10:14 pm Reply with quote
Joined: 10 Mar 2008 Posts: 5 Location: Canada
Hi,

The error message I get is something like:
Code:
Dynamic compile error: /usr/share/yaws/index.yaws:4: syntax error before: ':'generated file at: /var/cache/yaws/.yaws/yaws/debian_yaws/m25.erl

Regards,
Sebastian

On Thu, Sep 3, 2009 at 7:08 PM, andrew mmc <andrewmmc@gmail.com (andrewmmc@gmail.com)> wrote:
Quote:
It is hard to tell what the problem is without some form of error message to show where the failure is, but this could be a number of things.
View user's profile Send private message
Guest
Posted: Thu Sep 03, 2009 10:19 pm Reply with quote
Guest
I wasn't looking at the code but now I see you have periods at the end of each line instead of commas which won't help.
Guest
Posted: Thu Sep 03, 2009 10:31 pm Reply with quote
Guest
Hi again, I would structure it like the below, everything should be contained in out(A).


<html>
Guest
Posted: Sat Sep 05, 2009 2:40 pm Reply with quote
Guest
On Fri, 4 Sep 2009 00:30:05 +0200
andrew mmc <andrewmmc@gmail.com> wrote:

> Hi again, I would structure it like the below, everything should be
> contained in out(A).
>
> <html>
> <erl> out(A) ->
> application:start(odbc),
> ConnString = "Driver={MySQL ODBC 5.1
> Driver};Server=localhost;Database=test;
> User=root;Password=ace152;Option=3;", {ok, Conn} =
> odbc:connect(ConnString, []), Results = odbc:sql_query(Conn, "SELECT
> * FROM test_table"), {html,"Something here."}.
> </erl>
> </html>

Why not just write it like any normal Erlang function?

<erl>

out(A) ->
application:start(odbc),
ConnString =
"Driver={MySQL ODBC 5.1 Driver};" ++
"Server=localhost;Database=test;" ++
"User=root;Password=ace152;" ++
"Option=3;",
{ok, Conn} = odbc:connect(ConnString, []),
Results = odbc:sql_query(Conn, "SELECT * FROM test_table"),
{html,"Something here."}.

</erl>

--
Hans Ulrich Niedermann

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist

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 can attach files in this forum
You can download files in this forum