Mobilefirst platform local database connectivity with sqlite database - javascript

I want to maintain local sqlite database in MobileFirst platform.I tried with sql adapter. But its not successful. I dnt get what r the actually step or procedure for that.
Plz help me for that and suggest any tutorial which will helps to understand actual process for that...

A local SQLite database in your application has got nothing to do with SQL adapters. Adapters are a conduit allowing you to send and retrieve data from a remote backend, not local in the device.
If you want to use SQLite you will likely need to use either a Cordova plug-in or use the Send Action API to interact with Java code in your app.
Read about SQLite (I'm assuming Android here...): http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
Read about creating Cordova plug-ins for IBM MobileFirst: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/adding-native-functionality/
Read about Send Action API: http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.dev.doc/devref/c_action_sender.html

Related

How to sync database with electronjs

I would like to use electronjs to develop a desktop application. The app has to have an offline and online database, such that when the system connects to the Internet, the databases can sync.. How can I achieve this please. Using nodejs to develop apis
Sure, you can do that with sqlite database or pouchDB. If you don't want to write long queries for sqlite then you can use Prisma sqlite. then after just store it in the local database (sqlite or pouchDB) whenever the system is offline. and whenever the system will become online post the last data to your SQL/Postgres/Mongo server.

How to Sync Sqlite data to sql server using Cordova

Hi from so many days im searching about this topic but unable to get a hint also. if any one know how to sync sqlite data to sql server using cordova and javascript please help out
Open source implementations
There are some open source projects for syncing the PhoneGap app with the remote server. But you will have to adjust/implement to fit your project.
Synchronize a local WebSQL Db to a server
Couchbase Lite PhoneGap plugin
Pouchdb
Alternativly, custom API
You could create your own set of API methods to send / update data from the WebSQL to your remote server DB. Flagging records that need to 'sync' to the external server. But you'll have to take measurements for a large bit of logics if the sync process is 2 way (central server - app - central server).
Since your question limits the amount of information it's hard to help out with more detailed information in this stage.

Storing data offline on a Node.js backend for Android

I am running node.js server side with MongoDB and I like the use of the NoSQL databases as it is easy to run with.
The android app I am creating stores data into the database from Node.js when it is online, but I want to have a functionality to retrive data offline from the DB?
I have a app.post set up, but I am still not sure how to communicate server-side offline?
You can't communicate server when off-line.
Suggestion : When sever is off-line you have to store data in android database.

Is it possible to perform database operation on locally stored DB through javascript (WebSQL or Indexeddb)

i am developing offline web app for android platform and i want to use offline database for it. Is there any way to connect to locally stored database through javascript. like
var db = opendatabase("file:///android_asset/myLocalDb.db");
var Records = db.executeSQL("Select * form myTable");
echo Records;
I use PouchDB. It is a NoSQL type database backend, but has great cross platform support so you don't have to worry about the underlying storage mechanism across browsers. If you have flexibility on the database type, it may be the easiest solution.
Are you making a Cordova app, or in-browser hybrid offline but specifically targeting Android? You can use SQL Lite with Cordova and bubble up from your Javascript to access the db. Check out: https://stackoverflow.com/a/26609184/1011603
Yes, it is possible to package your application and data file as web app by packaging appcache. Since browser manage data storage for database (indexeddb or websql), it is not possible to specify them by your file name.

Making offline version of web apps

So I'm building web apps or website using laravel as php backend and bootstrap for frontend and using mysql (phpmyadmin) database from hosting service. so because in my country internet connection is bad i thinking a way of making my website to be available or can be used without internet connection , so it will be like this
When bad or no internet connection my website will load local data like html,js,css and also database mysql from local machine
When internet connection is good or available my website will load data like html,js,css and also sync database mysql (phpmyadmin) from local machine into hosting service or otherwise
So how to achieve that?
Use a Service Worker to mediate your front-end network connections and store data locally when no connection is available.
If you just need to sync database to remote host, you can use the MySQL replication setup.
http://dev.mysql.com/doc/refman/5.7/en/replication.html
The FAQ has already told you that the connection doesn't need to be always available
https://dev.mysql.com/doc/refman/5.5/en/faqs-replication.html
Hope this helps.

Categories