How to synchronize localhost database and server in java? - java

I am stuck at this and search a lot about it but didn't find any solution.
I created software in Netbeans that is currently connected to the local database (localhost PHPMYADMIN), now I have a server. What I want to do is that, For example, when the user clicks on the save button data must save in the local database and then upload on the server (at the backend). I didn't want to save data at the same time on both server and local because its time taking and slow down the software performance.

Related

Local Database for Java application

I have a client server based application.
The server is PHP with MySQL, no big functionality, just for keeping my data and providing and administration interface.
The client is a Java (FX) application.
Unfortunately the connection between the client and server is not permanent, so I have to have a local copy of the database for the case the server if not accessible.
Most of the times the client only reads data from the database but there are a few cases when it needs to update it.
My question is: what is the better solution to keep up a local copy of a MySQL database and track changes (to be updated in MySQL next time it is available).
It is a complicator factor that I do not need the full database locally, it would be too large, I need only the user specific information (user is authenticated by local machine username)
Do you have any idea? :)
Thanks:
Levente

How would I go about creating an android app that displays tables of data from an SQL Server?

I'm trying to make an android application that displays tables of sorted data which is stored on a 2008 MS SQL Server. I already thoroughly googled this issue and essentially every person who wanted to connect to a server directly through Android was told they should make a web service which bridges the app with the database server. Problem is, I have no clue how to do that. I only have (v. limited) java/android knowledge.
Instead, I was hoping that the data on the server could somehow be stored locally on the phone and used by the app, instead of connecting to the server directly, which is slow and insecure. (This is a HUGE database we're talking about - 100,000s of entries) Would that be feasible at all?

Sync MySQL Databases via SSH using Java

I have a MySQL database installed in my Amazon AWS instance (not RDS). The same database is installed in a personal computer, offline.
You have to connect to the amazon database via SSH, it is in a Ubuntu instance.
The online database contains information of 1000 users. The offline versions contain information only for that particular user.
Users use a Java desktop application to feed data into the local database. When they click on the Sync button, the 2 databases should be synced. Remember here that the desktop offline database should "upload" the newly inserted things to the online database while it should "download" new data (if any) related only to the particular user .
The system cannot be a manual way where someone manually turn on a 3rd party application, use putty or connect SSH, configure the databases etc and sync. The system should be embedded to the desktop java application.
I looked into things like SymmetricDS and it is too much complicated, not sure about the SSH access too.
Any idea about how to do this in an easy way? I am also creating a REST API thinking I can handle this manually, but if there is already built system/API I am onto it.
This is very simple and doable. Just use MySQL replication.
MySQL replication
Let me know if you want any further details. I can give you working model of my.cnf as well if required.
Br//

network server mode vs embedded mode in JavaDB

I am trying to develop a desktop application to be run on local network. It has two UI. One for users to log in complaints and another one to process the complaints. Both of them are connected to a single database. Now i want to know weather i should use the JavaDB in embedded mode or network server mode to implement this and what is the difference between the two approaches.
In embedded mode the database code runs in the same process as the embedding application. The database files are locked, no other process can access the database files. This is the right choice if you have only one application with one user per database. The advantage over network mode is that there is no network traffic to access the database.
In network mode the database code runs in its own process (the database server). Client applications can access the database over the network. Several client applications can access the database at the same time. So this should be the right choice for you, because you have two different client applications accessing the database at the same time.

Java: how to upload files to server and handle authentication?

I have a small linux vps. I have written a Java client application, which needs to connect and submit large string data and images. The string data will be stored as regular text files on the server, and will be parsed by another Java application that will run on the server and use this uploaded files and images.
The next part of the problem is, because this Java client will be run by several users, I need some way to uniquely identify each uploaded file to the currently logged in user session on the website (the user needs to login on the website, to be able to run the tasks). Any suggestions or more efficient patterns ?
Don't write the stuff to files. Punch the uploaded data into 'raw' database tables by user ID. The batch job job can pull the data out, parse/format/fold/spindle/mutilate, and stuff the results into the real tables, then delete the raw data.

Categories