3

I need some database functionality for our intranet at work, but I am severely limited in my options. My only scripting tools are JavaScript/JQuery.

I was wondering if it would be possible to use SQLite with html5 and JS/JQ?

Thanks for all the pointers in the right direction!

Desired usage:

I wish to port in a large excel sheet in the db file, and run queries and return row results in the intranet page.

3
  • 1
    No, it's not possible to use SQLite with just Javascript alone. What exactly do you mean with "some database functionality"? What exactly are your requirements? How much data do you need to store? Do you need to share it between browsers? What queries do you need to perform on the data? Commented May 12, 2015 at 16:30
  • 2
    YOU CAN! use github.com/agershun/alasql Commented May 12, 2015 at 16:33
  • @Philipp it is possible to use sqlite from the browser. You can use something like bookshelf.js, check bookshelfjs.org/#faq although i dont recommend it outside a server enviroment either. The native localStorage will do the job in most scenarios Commented May 12, 2015 at 16:38

2 Answers 2

3

Yes it's possible, there are some libraries on the web. For example, the library sql.js is a port of SQLite to Javascript.

Sign up to request clarification or add additional context in comments.

5 Comments

How would you share data between different clients? Using a file? But then, what about database synchronization? I'm quite curious indeed
@A.Wolff Two client doesn't have the same data base. You need to synchronize with a server your data base.
Ya and so this is quite limiting all the purpose of it
@A.Wolff If your application does not set data and just get data, this library is helpful. Or if you create a local application with one client.
This would be retrieve only at this point, and quite possible all that will happen with this db
0

There are many options to solve this problem:

  1. There are some packages, which can read data from XLSX file directly, for example: js-xlsx library, where you can retrieve data directly from Excel table (so, you do not need to use SQLite). It takes some time to read whole Excel, but you can keep your XLSX alive.

  2. You can install simple node server for your intranet with SQLite package. This is a fastest way, because the client version of SQL.js loads whole file with database, which can be much bigger than original XLSX file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.