I am currently working on an Android project and will have to manage database connection and queries to store data. I will not be working with SQLite as provided by the Android device and using it is not an option.
As I need to build quite a lot of queries I wanted to use a library or framework to make the task easier. Looking at what was available, it seemed easiest to use a framework such as, for example, QueryDSL.
However, since I am working on Android, I am not sure if the framework is usable and what using it would entail. Does somebody have experience using an external database with Android and have any recommendations?
The recommended way to connect to an external database is to use a REST client.
See this post
Related
Beginner here,I have tried getting the data using mongoDB driver which proved to be a herculean task as the app crashed every time I tried to create a connection to database.(The queries ran perfectly if executed separately). Then I tried to implement the queries on an asynctask class which ran on a separate thread in android. I feel there is a much simpler way to achieve the task at hand. The data i am trying to access is required by the UI of the app , so it should be fast.
I have referred this question but how exactly do we go about creating a web service . Can we use a framework like flask?
Please start with the following tutorial. Here is the Xamarin version. There are also other version of this tutorial, depending on the technology stack relevent:
.NET
Node.js
Java
Python
Build mobile applications with Xamarin and Azure Cosmos DB
I am building a social media application which requires local storage of table data entities. This data must also be connected to a server to retrieve and update information to and from users. Our team has built an iOS client using core data, though we are looking for storage options in android. Is using SQLite the way to go? Any thoughts would be greatly appreciated.
You should take a look at Realm, it has clients for Objective-C, Swift and Android.
Description from their GitHub repository:
Features
Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets and wearables.
Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues. Plus, we've worked hard to keep our API down to very few classes: most of our users pick it up intuitively, getting simple apps up & running in minutes.
Modern: Realm supports easy thread-safety, relationships & encryption.
Fast: Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.
If you're familiar with RxJava, you will probably want to check SQLBrite, wich is Square's solution for this.
Yes, Sqlite is a default storage solution for android. Howevere there is a wrap around it called ContentProvider. ContentProvider can be used with Loaders and provide async data loading. ContentProvider may be used to modify contats and merge accounts, see this guide. However ContentProvider may seem tricky and if you prefer ORMs you can use ORMLite or GreenDAO which are using sqlite as well.
I'm getting started on a contracting project bid, and I was hoping for some advice on the best way to go about it.
I am being asked to develop an Android application for inventory management for a small company (no more than a few thousand SKUs at most) for Android tablets and I'm trying to come up with the architecture for the system.
I was thinking of using MS Server 2008 hosting a MSSQL database. This database would be exposed via REST services, as the DB would need to be accessible remotely (through Android tablets by salespeople).
I haven't used SQL much in the past, but I am thinking this is likely the best solution, along with REST for performing remote DB transactions.
Basically the functionality would be to view stock, order items, check prices, etc.
I would appreciate any advice anyone has on this topic.
Thanks!
I recommend you go over this article: Creating an OData API for StackOverflow including XML and JSON in 30 minutes. Then, consider the odata4j project.
Also, here is an interesting lecture about clienting REST for android:
http://developer.android.com/videos/index.html#v=xHXn3Kg2IQE
I would go for Oracle Application Express. They have build in Jquery Mobile and easy to expose a report list as Rest web service. Then use Phinegap and Jquery for Android apps.
Take look my quick sample: http://m.youtube.com/index?desktop_uri=%2F&gl=US#/watch?v=5rfuq-e-_Ws
You are not building an enterprise system....give a try Oracle Apex...you will be addicted to it.
Phonegap, Jquery Mobile and SQLite as local database on Android tablet .... Only if you need offline capability. Otherwise just use Oracle Apex with build in Jquery Mobile will be super solution!
I recommend you take a look at restSQL, an ultra-lightweight persistence framework. It currently supports MySQL and PostgreSQL. See http://restsql.org. It runs in a standard Java EE container, e.g. Apache Tomcat.
restSQL is not a conventional ORM. It does not present an object-oriented view of the database. It presents flat or hierarchical "views" of relational database tables. These views are query-able and updatable through a simple REST-based HTTP or Java API. The HTTP interface is based on REST principles, which use HTTP’s built-in features, rather than abstracting away from them.
I have used http://www.remobjects.com/ for this. Create the server in .net, delphi and clients in anything.
Also, is possible to use just http://www.remobjects.com/da/relativity.aspx if not have heavy logic in the middle-tier.
I have been searching and have found out, that android supports only SQLite databse and no other. Is this true?
Yes. The Android library provides native support to only SQLite. Of course, this doesn't mean you absolutely can't use other databases on Android; if you need to use other databases, you'll have to either look for already-existing third-party libraries(1), or roll out your own API.
(1) Careful there: If you look for third-party libraries, make sure they're built specifically for Android, since Android includes only a subset of the Java standard library. If they're not specifically built for Android, there's a possibility that the libraries won't work due to missing classes.
Yes, Android Supports H2 Database too. please check it out with below link,
http://www.h2database.com/html/tutorial.html#android
Thanks,
Though SQLite is natively supported on Android and is most used database, there exists other options as well. Listing a few of them below;
Realm:
Reactive, concurrent, and lightweight, allowing you to work with live, native objects.
https://realm.io/docs/
H2:
Full Unicode support including UPPER() and LOWER().
Streaming API for BLOB and CLOB data.
Fulltext search.
Multiple connections.
http://www.h2database.com/html/tutorial.html#android
CouchDB:
Full CRUD and query functionality, NoSQL, lightweight, embedded, syncable
https://developer.couchbase.com/mobile/
LevelDB:
Lightweight and single purpose (not an SQL database)
http://leveldb.org/
Java wrapper: https://github.com/hf/leveldb-android
I am not including BerkeleyDB here as (AFAIK) it needs OS level changes to be made to replace the SQLite routines. More info here https://blogs.oracle.com/berkeleydb/now-you-can-build-berkeley-db-into-your-android-apps
SQLite is the only one I ever actually see being used. I would suggest using it because it is lightweight and free to use. When developing your App, lightweight is key, memory is limited on these devices! Is there any specific reason why you wouldn't want to use SQLite? Any feature that you're looking for that you don't see in SQLite?
I'd like to use myBatis (iBatis 3) in an Android application. Has anyone tried such a thing or know of any resources for this?
aBatis is a data mapper framework available for Android
that couples objects with stored procedures or
SQL statements using an XML descriptor or annotations.
aBatis is like an Android equivalent of iBatis.
---simple & light ORM library like iBatis for Web development
--carrying ibatis's feature
--easy-to-use as iBatis
--shorten a development period
--independent of development phase
--Android sdk1.6 and up
http://sonixlabs.com/abatis/
The first thing to do in order to do that is to compile myBatis for Dalvik. But it's likely to be too heavy for a device like a smartphone.
If you are looking for a lightweight persistence layer, you could look at Ammentos:
http://www.ammentos.org/
Same trouble: you will need to compile it for Dalvik.
Existing ORMs for Android:
http://ormlite.sourceforge.net/sqlite_java_android_orm.html
https://www.activeandroid.com/
It's better to use lightweight lib in android apps like greenDAO or Ormlite, greenDAO is an open source project to help Android developers working with data stored in SQLite. SQLite is an awesome embedded relational database. However, developing for it requires alot of additional work. Writing SQL and parsing query results are quite tedious tasks. greenDAO will do the work for you: it maps Java objects to database tables (often called ORM). This way you can store, update, delete, and query for Java objects using a simple object oriented API. Save time and focus on real problems!
greenDAO’s primary design goals
Maximum performance (probably the fastest ORM for Android)
Easy to use APIs Highly optimized for Android Minimal memory
consumption
Small library size, focus on the essentials
I create simple android project that using mybatis
check this: https://github.com/gustaroska/HijrDroid