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 扩展程序连接到数据库?


基础教程推荐
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01