Acces a PouchDB in android/java? - java

I am trying to fetch data from a PouchDB in Java for my Cordova app. I have made a backgroundservice in Java using this plugin. I use that for my cordova application to fetch some relevant data from my API. To get this data i need some information of the user, like the ID, which i have stored in my PouchDB in the JavaScript. Now i want to fetch this data in my BackgroundService.
I have tried:
SQLiteDatabase db = openOrCreateDatabase("Survalid",MODE_PRIVATE,null);
But i have been unable to find the right documentation of getting data from the database. Also since the SQLiteDatabase object is a class from android, i think it creates a new Database rather then opens the existing pouchdb.
Question in short:
Is it possible to open and fetch data from a PouchDB in Java, if so how?
Thanks in advance.

Check out sqlite plugin 2 and where is data stored which tells you how you can access the data from Java. Note, though, that you probably shouldn't modify this data, although you can read it if you want.

Related

Sync SQLite DB on android studion with MySQL DB on web server

I am developing an android app that measures the radio interface parameters of a network periodically, stores the data in SQLite DB and transfers the data stored to MySQL DB on a web server. How can I make this possible?
I've done some research on this and found only one usable option, which is to make a web service using json or xml to pull/push data between the two databases. You could create a database link between the two, but this is not advisable.
There are numerous questions with a more detailed scope for this issue and you should be able to find one that fits your use case. If not, ask a new question after this research with more details and what you've done so far.

How to store images in ArangoDB?

I want to store images in ArangoDb as image file. I want to know if there is any API or Java API for the same. Thanking You in advance.
Storing binary data inside ArangoDB has been a long standing feature request.
Currently its not possible out of the box.
One can however do this by creating a foxx service that handles the data.
The recommended way is to create a file and reference that file name inside the database.
A detailed description and an example foxx app can be found in the cookbook

Collect Data from DBMS_PIPE using Java

I am currently working on a project where a lot of users will be making changes to our data and that rest of the clients are suppose to see data as soon as it updates. I have implemented web sockets to broadcasting the data the problem is we are using Oracle DBMS_PIPE as whenever data is changed in the DB now I was wondering if there is some api or some documentation which tell how to collect data from DBMS_PIPE using Java. any suggestions?
Thank you
F. Irfan

Putting media into an Access Database using Java

I'm making an email system in Java using an Access database as connectivity. What would be the best way to get and upload media/files (.gif, .au, .mpeg and .txt) attachments to the access database? What datatype would the field in the database have to have? I think that i have to convert the file to binaries to be able to store them, i have no idea how i would retrieve them so i can open them in the Java GUI. Could any body explain how to do this so i can add it into my program, or explain any alternatives?
OLE OBJECT is really the only option you have if you want the actual binaries to be stored in an Access Database.
You'll probably be able to use setBlob and getBlob to work with it.

Setting up sqlite database

Sorry I am a noob, I am trying to learn about sqlite databases using linux, I cannot find any tutorial that covers what I need from setup to creating to using. At the moment tutorials I find say open a shell using adb shell command but when I open a terminal this does not work even if I navigate to the android tools folder, I can get the sqlite command working but the tutorials dont explain how I use it. For instance, how do I store urls and map coordinates and how to I reference them.
I have tried to use the firefox plugin but I havent got a clue what it all means and every tutorial says sqlite database is easy but it seems so complicated.......HELP!!!!
P.S would it be possible to create the data within the application code, I have seen some apps that do this
Does anyone have a set up guide and tutorial that can help?
Take a look here: http://developer.android.com/guide/topics/data/data-storage.html#db
You should use a custom class extending SQLiteOpenHelper: http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html
It gives you methods like onCreate, onOpen and onUpgrade which are very useful.
To set up your database :
The recommended method to create a new SQLite database is to create a subclass of SQLiteOpenHelper and override the onCreate() method, in which you can execute a SQLite command to create tables in the database.
To use it :
You can execute SQLite queries using the SQLiteDatabase query() methods, which accept various query parameters, such as the table to query, the projection, selection, columns, grouping, and others. For complex queries, such as those that require column aliases, you should use SQLiteQueryBuilder, which provides several convienent methods for building queries.
Resources :
developer.android.com - Data Storage
Are you using Java.
You can have a look http://www.zentus.com/sqlitejdbc/
Android has a class named SqliteOpenHelper using which you can create and communicate(do read / write operations) on sqlite using java. You can find many samples once you start searching in net. Here is one such sample.
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
If you want to open your database you can use Sqlite Manager which is available with Firefox as a Addon. It has a easy interface so that you can load your database directly and check .
If you are planning to create a new SQLite database then over ride and implement the onCreate() Method.
But if you are using a SQLite database that is created by another external source and you are going to pull it down, then leave the onCreate() method empty.
You might look at SQLite Manager, which is a free GUI and available in a Linux variety. I highly recommend it.

Categories

Resources