[英]How do i access MySQL with Erlang's Yaws web server
is it possible? 可能吗? if so, how?
如果是这样,怎么样?
I know php and MySQL run together with Apache. 我知道php和MySQL与Apache一起运行。
but, how can I get access to the MySQL database using Yaws script? 但是,如何使用Yaws脚本访问MySQL数据库?
Yes, it is possible, here is some example code: 是的,这是可能的,这是一些示例代码:
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.