connecting to an existing sqlite db with javascript - javascript

I'm trying to build a "bookmark manager" for a browser,it should read data from an existing database on the user's machine.
I tried ST2 and it's proxy,it's explained here ,but it creates its own database,I can't get it to use an existing database.
I tried the sencha sqlite proxy ,it does the same,it's not even in their documentation
so i'm stuck again.
Is there any way to do this with Sencha?
Another question is : can I do this using just Javascript or jQuerymobile ,or any other library out there?

You can't connect to an existing DB. Think of the security issues if you could.
Edit: is local-storage an option?

Related

Autodesk Forge - Extension button to get data from external SQL database

I am trying to connect my Forge app to a sql database, but I have no idea how to do that. I am new to forge and web development, so I don't know how to look for the best approach to solve this.
I found a code that does exactly what I want, that is getting the data from a specific table of my database, but I'm not able to put this code inside my forge app, mainly because it uses a require() function and I can't put it inside my extension button.
By the way, I'm trying to make a button in my extension where I click, it access my database and get data from it.
Would be really nice if someone could help me with this silly doubt that probably already has a solution in the internet and I'm not able to find it.
Sorry in advance if it's too obvious.
This problem is more related to web development than Forge.
Your app should be made of 2 parts : the frontend (html/css/js) and a backend (probably nodejs as you tagged it).
Your frontend should not access the database directly. This is the job of your backend.
In your backend, add a library to access your database such as Sequelize (if you are working with NodeJS). Then you will do a request from your frontend to your backend to get the data from the database.
You probably have something working like that for your Forge Access Token, depending on what you use to start your development.

How to create a database to store logs using phonegap?

I am dsigning an app for iOS using phonegap. What I want to do is log down the date and time each time when the user pressed a button on the screen, and be able to view the log on device screen with an admin access. I know I have to create some sort of a database to store the info, but can someone give me an example on how to create one as I'm new to phonegap and not sure how to do that.
In my opinion the best SQLite Plugin for saving a lot of data is this plugin:
https://github.com/brodysoft/Cordova-SQLitePlugin
There is no limit of storing. In this post How to compact SQL instructions in Cordova? I have written how to compact SQLite instructions, so you have not all this event overload.
But do you really want save every tap? That will be a lot of scripting work.
It seems as localStorage would be sufficient for your problem. You can simlply Json.stringify your data and put it to the local storage. Later get it from there and json.parse it. No phonegap needed just pure html5. Try search for localstorage HTM5

Best way to get and store data (optimized) to mobile app (Ionic, Cordova/Phonegap)

I want to do an app with ionic framework and cordova for Android and iOs and I want to optimize at most the requests to the server.
I need to get data from php server (API) and store in the mobile phone, this data is related, so I think that a SQLite is the best option to store it in the device because of to show it is more fast to do a complex SQL than get a JSON stored in localstorage (for example) and search and link the data in the mobile. I'm right?
I need to do this and can do a Pull to refresh in the app and get only new data.
I've been watching some solutions but I don't know what is the best.
Parse/Firebase: This is difficult to administrate for non-specialists, for this I have a backend to enter and modify data with the relations easily. In addition this services return a JSON with more data that I need.
Persistence.js and Persistence.sync.js this works with mysql-server and sqlite-local but can I sync only one table or get only the new data? And I did't find a solution for php server.
CouchDB and PouchDB: I don't know if this can be sync only for a new records.
Receive data in JSON and store it in SQLite: I need to create functions to do this easier.
Any other solutions?
I'm very lost in this topic.
Thanks!!
CouchDB and PouchDB: I don't know if this can be sync only for a new records.
That’s the default. Plus they handle all the nasty sync details for you. Would highly recommend looking into this.

How can I connect a SQLite local database to a HTML frontend?

I've recently ported a simple database from Ms Access to SQLite, because I wanted an open source option. Now I'm facing the problem of developing a visual form for data entry in that database.
This related question (HTML/JS as interface to local SQLite database) pretty much summaries what I want to do: create an HTML/JavaScript frontend for data entry in a SQLite local database. In that thread, the user solved the issue by creating a local web server via Python script.
The question is: how do I connect my HTML file to that local web server? Is that via PHP or something similar? Please point me to the right research direction. Thank you!
Yes, you should use PHP or something similar, possibly Ruby on Rails or Django. The last two make life really easy and help abstract the database.

Online/offline data updating mobile best practices

I have a requirement to create a mobile app that has the ability to queue up records that need to be saved when no internet connection is available and update the data via web api when a connection is available in our SQL Server DB.
I'm trying to avoid having a local version of the DB on the device which I've seen some others recommend in other questions on stackoverflow.
The approach I'm going with right now is to try and save the records in a local store (JSON) while there is no connection. Then to try and hook in some event to know when the connection has been re-established to update my data to SQL Server.
I'm just wondering what the best practices are around this? Are there issues with my current way of trying to solve this problem?
We are using DevExpress's DevExtreme mobile solution with Visual Studio 2012 and Cordova PhoneGap.
Any advice would be very much appreciated.
How big is the JSON data that you want to store, likely to get?
Depending on your answer, you could store it (the JSON data) in localStorage and then write it next time the device is connected.

Categories