Is it possible to access an SQLite database from JavaScript?(是否可以从 JavaScript 访问 SQLite 数据库?)
问题描述
我有一组 HTML 文件和一个 SQLite 数据库,我想使用 file://方案从浏览器访问它们.是否可以使用 JavaScript 访问数据库并创建查询(和表)?
I have a set of HTML files and a SQLite database, which I would like to access from the browser, using the file:// scheme. Is it possible to access the database and create queries (and tables) using JavaScript?
推荐答案
其实答案是肯定的.以下是如何执行此操作的示例:http://html5doctor.com/introducing-web-sql-databases/
Actually the answer is yes. Here is an example how you can do this: http://html5doctor.com/introducing-web-sql-databases/
不好的是浏览器对它的支持非常有限.
The bad thing is that it's with very limited support by the browsers.
此处的更多信息HTML5 IndexedDB、Web SQL 数据库和浏览器战争
PS:正如@Christoph 所说,Web SQL 不再处于积极维护状态,而 Web 应用程序工作组会这样做不打算进一步维护它,所以请看这里https://developer.mozilla.org/en-US/docs/IndexedDB.
PS: As @Christoph said Web SQL is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further so look here https://developer.mozilla.org/en-US/docs/IndexedDB.
编辑
正如@clentfort 所说,您可以使用 SQL.js 使用客户端 JavaScript 访问 SQLite 数据库.
As @clentfort said, you can access SQLite database with client-side JavaScript by using SQL.js.
这篇关于是否可以从 JavaScript 访问 SQLite 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以从 JavaScript 访问 SQLite 数据库?


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