Can I connect to a database using JS?

0

I'm developing a website for myself and would like to know if I can use JavaScript to connect to the database and get a value.

The site is local, and the bank is also on my machine, do you know if I can connect using JS? How?

    
asked by anonymous 20.02.2016 / 01:09

2 answers

1

The javascript should be used only and exclusively for the client side, more precisely in the browser sandbox.

To communicate with the database you will inevitably need to work with some server side language. I personally indicate PHP in these cases because it has almost zero dependency and most web servers have it by default.

    
20.02.2016 / 03:00
0

In MySQL 5.7 you have the HTTP Plugin with which you can do what you want. There are other means as well, but this is the best known. The plugin is basically a REST API.

Another way is by using ActiveXObject, connecting through the ODBC ADODB. Of course in this case the browser must have permissions enabled to access the ActiveX object.

    
20.02.2016 / 02:24