Is it possible to access a MySQL database straight from Javascript

前端 未结 6 1742
孤街浪徒
孤街浪徒 2020-11-30 15:23

Is there a way to access a MySql database using entirely client side Javascript or do you need to go through a server side language such as PHP or C#?

Thanks

6条回答
  •  误落风尘
    2020-11-30 15:57

    You need to go through the server. Giving the client-side code direct access to the database would be a massive security hole, even if you could do it.

    Note that you can use JavaScript on the server, you don't have to use PHP or C#. There are several server-side JavaScript engines you can use, NodeJS (which runs Google's V8 engine) and Rhino (which runs on the Java stack) being two of them. And of course, Microsoft has supported JScript on the server for at least 15 years.

提交回复
热议问题