Connecting to DB from a Chrome Extension?(从 Chrome 扩展程序连接到数据库?)
问题描述
我正在构建一个 chrome 扩展程序,该扩展程序仅适用于我工作的公司内的人员.扩展需要输入 - 可以通过对共享 MySQL 数据库服务器(所有员工都可以使用只读权限访问)的简单查询生成.
I am building a chrome extension which will only be available for people within the company I work for. The extension needs input - which can be generated with a simple query to a shared MySQL DB server (to which all employees can access with read only permissions).
问题是 - 由于扩展都是客户端(主要是 Javascript) - 访问数据库和运行查询的最简单方法是什么?我是否必须为扩展创建一个 php/java(/...) 服务?
The question is - since the extension is all client side (mainly Javascript) - what's the simplest way to access the DB and run the query? Do I have to create a php/java(/...) service which does that for the extension?
推荐答案
您必须创建一个与数据库交互的中间 Web 应用程序.然后,您可以从扩展程序向您的网络应用程序的 API 发出 AJAX 调用,后者将依次查询数据库并返回结果.
You'll have to create an intermediary web app that will interface with the Database. Then you can make AJAX calls from the extension to your web app's API, which will in turn query the database and return results.
Chrome 扩展 → Web App API → MySQL
Chrome Extension → Web App API → MySQL
点击此处了解有关 Chrome AJAX API 的更多信息
这篇关于从 Chrome 扩展程序连接到数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 Chrome 扩展程序连接到数据库?


- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01