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 数据库?


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