如何在html5中连接mysql数据库? [英] how to connect mysql database in html5 ?

查看:1049
本文介绍了如何在html5中连接mysql数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在html5中连接mysql数据库?

how to connect mysql database in html5 ?

推荐答案

让我们解决这个问题:出于多方面的原因,努力朝着这个方向努力并不是一个好主意。

但实际上你可以做到 - 僵尸不是直接的。 Legacy MySQL只有有限的接口,我们称之为API。此API在PHP,ODBC,ADO.NET,EF等驱动程序中实现。但是这些不能在bowser中使用,它们在服务端可用,并且它们由服务器上运行的代码使用并实现业务逻辑。这是一个健康的分离。但是,如果有人提供可以在浏览器中使用的通用接口(API),那么您就拥有了所需的内容。在遗留的html中,这将是一些基于http的REST API。你有它: http://www.infoq.com/news/2014/09/MySQL- REST [ ^ ](另见: http://blog.ulf-wendel.de/2014/ mysql-5-7-http-plugin-mysql / [ ^ ])。

在html5中你有一些名为WebSocket的新东西,它可以带来比REST API更高级的功能和更高的吞吐量,但我还没有看到它已经实现了MySQL。
Let fix this: it is not a good idea for many reasons to strive in this direction.
But actually you could do it - bot not directly. Legacy MySQL has only limited interfaces, let us call them APIs. This API is implemented in drivers for PHP, ODBC, ADO.NET, EF... and so on. But these can't be used from bowser, they are available on served side and they are used by code running on the server and implementing business logic. This is a healthy separation. But if somebody provides a general interface (API) that can be used from within a browser, you have what you wanted. In legacy html this would be some REST API over http(s). And there you have it: http://www.infoq.com/news/2014/09/MySQL-REST[^] (see also: http://blog.ulf-wendel.de/2014/mysql-5-7-http-plugin-mysql/[^]).
In html5 you have something new called WebSocket which could bring more advanced features and also higher troughput than REST API, but I haven't seen it implemented yet for MySQL.


您实际上可以使用MySQL连接器进行Javascript: http://dev.mysql.com/ doc / ndbapi / en / ndb-nodejs.html [ ^ ]。



但是,我不推荐它,因为你必须向所有客户端计算机公开MySQL服务。只在客户端访问数据访问层更安全,但是您需要使用服务器端技术之一。可能是带有ADO.NET,PHP等的ASP.NET。



-SA
You actually can use MySQL connector for Javascript: http://dev.mysql.com/doc/ndbapi/en/ndb-nodejs.html[^].

However, I would not recommend it, because you have to expose you MySQL service to all client computers. It's much safer to have a data access tier accessible only on the client side, but then you will need to use one of server-side technologies. It could be ASP.NET with ADO.NET, PHP, and more.

—SA


这篇关于如何在html5中连接mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆