shared SQLite db on windows with android applications - java

shared SQLite db on windows with android applications
I want write application android that install on some device android
I want Center Database for all of application install
I want shared one SQLite db on windows with my Application
I use Web Service but i want use connect to db with IP or (local network) or other way
thank you

I don' think you will be able to connect to remote SQLite database via socket (IP) connection from Android. Mobile data connections are not so reliable as LAN or WiFi on notebooks/PCs.
I think webService is the best solution for you. All your clients (Android apps, Windows apps) should connect to this webService.
Difference is that webService call it's just short connection (connect, send request, receive response, close connection), while database connection need to be persisted in time and can be interrupted, which may cause in inconsistent data or broken transactions.
EDIT: Other way is to use some MBasS (Mobile Backend as a Service). For example Parse.com. It could be your database and the provide their own REST API to access it.

Related

Android SQLite and Desktop Sync

I am unable to figure out what is the best way to achieve a scenario like this:
Working on a project that would have android application as client.
User will take their device with the android application installed to field/visit and capture/punch/key data through out the day. This data would be stored locally on the device in SQLite database.
The data captured in SQLite needs to be exported out and imported into the desktop app (it could be java or .net based) for further processing.
Other points:
A. User could connect the phone via usb to desktop.
B. data flow would always be in one direction (i.e. Phone to Desktop).
C. No internet connection on the phone
My dilemma is how to access the sqllite database programmatically in desktop application? Are there any JDBC drivers that could read data from the sqlite database from a device connected via USB to the computer?
This is just a way to do what you want, there are more ways to do it but from my point of view is the most accurate and scalable.
You would have to make a webservices server on Java, PHP, etc ... with a database MySQL, MongoDB, etc ... and so the mobile device is synchronized with the database that was the cloud.
Thus after a desktop client would connect to the webservice to bring the data in order to process it on your desktop client.
EDIT:
You can view this post's
send-data-from-android-to-pc-via-usb
transferring-data-usb
bi-directional-data-transfer-through-usb-between-an-android-device-and-a-pc-mac

Is it Possible to run both Server and Client android applications Locally?

I'm looking to program a network application. I was going through: http://www.stanford.edu/class/ee368/Android/Tutorial-3-Server-Client-Communication-for-Android.pdf which talk about server and client programming for android. Now imagine I don't have an internet connection and I want both server and client applications run on either same android device or different android devices locally.
Is it possible to develop and run both server and client applications using TCPIP/UDP/Multicast locally on either standalone android device or multiple android device?
Yes, it is possible to communicate between Android devices or applications that are not connected to the Internet.
If you are using different devices, you probably want to use sockets, but it is possible to run an HTTP server on the server device and then use HTTP. Make sure they are connected to the same wifi network.
There are several different ways to communicate between different processes on the same Android device. The easiest might be to use a Messenger service but sockets and HTTP are also possible here.
Yes, it is possible in some manner.You can either use sqlite database present in android device to store various types of data in table form and data retreive from same.
Another way is to use Parse cloud as a server or backend of your client application.It allows your app to run even when you are not connected to internet.It stores the data in cache memory with its api and then uploads data to the server cloud as soon as you get connected to Intenet.
You can ask if you have any further queries. :)

Android strategy to store data

It may sound as if I am rambling (which I am anyways)
So I am thinking to create an android app which basically query my server to fetch some data based on user criterions and display it to the user (think of Yelp for example). User can push data also to the server (like ratings, comments etc.)
I want:
I want the app to be available in offline mode also (i.e. no network connection)
I can do it because:
Server side data will not be refreshed that frequently so no point in redirecting every request to network. For client updates however, (like when users gives a rating) I am not sure what to do. Should I immediately send it to the server or persist it in my local datastore and send it in periodic fashion?
How I am thinking of doing it (this is where I am confused)
Thinking of using phone storage to store data in SqlLite database?
How can I sync local db with cloud datastore? So that whenever connects to network or after a certain timeout period both client and server are in sync?
What should I use for cloud storage? How about Google App Engine?
How do people generally approach it? Looks to me common questions.
1. Thinking of using phone storage to store data in SqlLite database?
You can do just that, but i advice you read up on the other solutions plus the pros and cons about storage in Android here
2. How can I sync local db with cloud datastore? So that whenever connects to network or after a certain timeout period both client and server are in sync?
You can store the offline db (sqlite) data on a file and then upload (more like "backup") to a server (which can be Google App Engine) when you get Internet connection.Read more on this here
3. What should I use for cloud storage? How about Google App Engine?
Google App Engine is perfect for your backend server. this is the official documentation.You can also find tutorials on creating a Google App Engine connected Android app here

Access/Update a shared database

I need to share a mysql or ms-access database between a java swing application and a mobile device. The mobile has wifi access. The java application will run on my local pc (having no access to wi-fi i.e. the pc and mobile are on different networks) and will access/update the database. The mobile device will access a webpage (that utilizes the shared database) to get/post data.
If i host the webpage using free hosting (using either asp.net or php) and access it via mobile device, it can access/update the database. How can my local java swing application access the remote database on the free hosting website?
Is there another approach that i can take to achieve a shared database?
If your host allows direct MySQL connections (usually on port 3306), then you can access the remote database via the Connector/J JDBC driver provided by MySQL.
If not, then your Java application can access the database through the same PHP (or ASP.net) interface as your mobile application.

Connecting Access Databases remotely?

Currently I have a Java application which performs all I wanted and the limitation
in it is "It only resides on the Local machine for which it needs to work". I have the Access Databases located on a Remote Server and I install the Java app on the remote server to connect the databases using a connection string jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\\DATA\\DPPI\\DATA\\DPPI\\DPPIPR01.mdb;
It connects to Access Databases and do all the business logic with them.
Enhancements (to be done):
Making the application online - not a big issue.
Connecting the databases remotely - its the only concern.
If I make the Application Online the Access Databases need to be connecting through network (somewhat like IP or some web address).
Problem:
But after going through this Connect to Access database remotely It seems my requirement can not be completed.
Is there any way if I'm able to upload the database to the online web hosting server and access the database from there only? If yes, then how should I do the connectivity since Access Database connects by giving the fully qualified name containing drive letter and all.
But how should I proceed further so that I may be able to connect the mdb Databases remotely?
ADO Solution:
But after going through the link: http://webcheatsheet.com/ASP/access_connection_strings.php, it seems we can perform remote Access Database connectivity.
The solution for the ADO is something like:
connectionString="Provider=MS Remote; Remote Server=http://your_remote_server_ip;" &_
"Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\your_database_name.mdb"
I'm a tad confused to how Access Database we can connect.
There is one more question in my head.
I'm making use of Type-1 Driver. Should the Type-4 Driver support the remote connectivity?
If your application is a server side application (like a web application) and your server's OS is Windows then theoretically it is possible to use your Access database. In this scenario, the Access database is local to your application. In your connection string you can simply use the path to the Access database inside your server's file system.
But keep in mind, that Access is a desktop database not made to use it as a server database. This can lead to poor performance and maybe system crashes. And it is possible that there are some licencing issues for this use case.
So even it may be possible to use Access with a server application it is strongly recommended to use a real server database like MySQL, MS SQL Server, etc. Even an embedded database like Apache Derby or H2 would be a better fit.
If your application runs at client side like a fat client, then your only chance to use Access is to put it on a network filesystem, so it is visible from every client. But this works only inside a LAN. If you cannot put it on a network filesystem then you have to use a real server database.
Do not use Provider=MS Remote (RDS) for new development. Here is a quote from the MSDN article
Microsoft OLE DB Remoting Provider (ADO Service Provider)
Important
Beginning with Windows 8 and Windows Server 2012, RDS server components are no longer included in the Windows operating system (see Windows 8 and Windows Server 2012 Compatibility Cookbook for more detail). RDS client components will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Applications that use RDS should migrate to WCF Data Service.
As others have suggested, you should seriously consider using a different back-end database for this particular application.
What if I'm able to call another java application residing on the Server housing the Microsoft Access Databases? Can you please let me know if it can be the solution such that I will have the division of my application into two:
1. The Online java Application performing 2 things: Accepting the requests coming in and waiting for the response to come from another application running on the Server housing the Microsoft Access Databases.
2. The Java application installed on the Server housing the Microsoft Access Databases only responsible for connecting and returning the DTO (Data Transfer Objects) -or some kind of objects in Collections.
So, I would expect a serverside program to handle the communication with the DB and the client application would communicate with the server app.
Please let me know if I should proceed in this manner.
it can be done by marking the traffic and queueing the traffic from the server---to----remote site ---(QOS..quality of service ) .....the two sites will be connected through VPN methods to reduce the unnecessary hops that will improve the latency plus add the security , thus server and remote site will logically act as if they are on the same network (LAN)
regards ,
Ali Rehan

Categories

Resources