3

Is it possible to use jaydata to read a sqlite database directly in a html 5 css js page? This whitout the use of a php or asp.net engine?

EDIT: http://jaydata.org/

Lunatikzx
  • 264
  • 2
  • 14
  • 1
    What is JayData and what facilities does it provide for reading from databases regardless of the context? – Jon Cram May 29 '12 at 15:51
  • It provides a provider agnostic data access layer with JavaScript Language Query and JavaScript CRUD capabilities. You can issue the same statements to query or store data regardless of its origin: a local webSql or a remote YQL table. – Peter Aron Zentai May 31 '12 at 12:14

3 Answers3

2

Since it claims to support webSQL (right at the top of the homepage)…

JayData is the unified data access library for JavaScript developers to query and update data from different sources like webSQL, indexedDB, OData, Facebook or YQL.

… — yes (since all known implementations of webSQL use SQLite under the hood … which is why work on the W3C recommendation for it stopped).

(Although it should be noted that webSQL runs in the browser and is not a shared database that lives on the server. Exposing database servers directly to the WWW is generally a Very Bad Idea™, and SQLite is a plain file database, not one with a server, so it would require giving direct access to the server's filesystem to the WWW, which goes beyond insane).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Since i need offline access i wil lhave to use SQLite but i will dimb down the offline db to only get the data i need. – Lunatikzx May 29 '12 at 16:27
  • They do not replace the browser support for sqlite , they just use it... gonna have to find another solution – Lunatikzx May 29 '12 at 19:03
  • 1
    @PeterAronZentai — I think the intended question might have been "Can I use jaydata to create a client side database on a browser that doesn't support WebSQL?" – Quentin May 31 '12 at 12:24
  • @Quentin thanks your spot on , (sorry sometimes i cant explain myself clearly in english) – Lunatikzx Jun 04 '12 at 14:31
1

An HTML page in a browser can not access local databases, simply because it can not access the local file system. If you wanna do such a thing like opening an sqLite database file from an HTML page, you have to embed your HTML5 application into a native shell like phonegap. With that you can handle sqLite databases with JayData from within a HTML page just by using JavaScript.

Peter Aron Zentai
  • 11,482
  • 5
  • 41
  • 71
  • 1
    There is an alternative way: have your JavaScript code execute in nodeJS. That way you can access arbitrary sqLite files. This can be done on the client, but you have to deploy nodeJS requirements. Whould this be an approach you could take? – Peter Aron Zentai Jun 01 '12 at 08:32
  • i dont have any knowledge of nodeJS. Would it be doable to construct an app with nodeJS and installing it on the client desktop? – Lunatikzx Jun 01 '12 at 13:37
  • Yeah, but if you are new to this technology it might present a new factor for problems... It would create a local webserver on let's say 127.0.0.1:1234 and you still need a WebBrowser control embedded in an exe to communicate with it. So it's doable but not that simple. – Peter Aron Zentai Jun 04 '12 at 06:52
  • 1
    Another approach could be a web application that you mark as an "Offline app" with cache manifest. That way after the first use (that must be done from the net, let's say installation) the app can run from the desktop without net using Chrome or Safari browser. You can build your sqLite database with the application (you can not reuse existing ones). Is this a way you can live with? – Peter Aron Zentai Jun 04 '12 at 06:54
  • It answers the question about reusign an existing db ... thanks – Lunatikzx Jun 05 '12 at 15:06
1

You can use PhoneGap with SQLLite at the following URL is a working example.

https://groups.google.com/group/phonegap/browse_thread/thread/07cf9f48e3cd0663?pli=1

regards....