Access a MySQL Database in Electron(在 Electron 中访问 MySQL 数据库)
问题描述
我正在使用 Electron 创建一个应用程序,并且想在我的本地主机的 MySQL 数据库中选择和插入/更新一些表,我该如何与数据库建立连接?
I am using Electron to create an app, and wanted to get to select and insert/update some table in a MySQL Database in my localhost, how can I make the connection with the Database ?
PS:我对 Electron 很陌生
PS: I am very new to Electron
感谢您的帮助.
推荐答案
Electron 是 Chrome 中使用的 Web 渲染器 Chromium 和 Node.js 的组合.将 Node.js 添加到混合中使 Electron 能够以普通网页无法使用的方式与本机操作系统一起工作.使用 Node.js,您可以访问 Node 当前可用的所有库,因此这个问题的答案与如何从 Node.js 连接到 MySQL 的答案相同,您可以在此处找到:MySQL 与 Node.js.此答案中的代码应该可以在 Electron 中使用.
Electron is the combination of Chromium, the web renderer used in Chrome, and Node.js. Adding Node.js to the mix gives Electron the ability to work with the native OS in ways normal web pages cannot. With Node.js at your disposal you have access to all the libraries that are currently available to Node, and so the answer to this question is the same as the answer to how to connect to MySQL from Node.js which you can find here: MySQL with Node.js. The code in this answer should work in Electron.
这篇关于在 Electron 中访问 MySQL 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Electron 中访问 MySQL 数据库
基础教程推荐
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
