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//
Related
I am just a beginner in android app development and that's why I have many doubts. I am building one application where the user enters some data in editText. Now I want to save that data in my database. My database is running on my laptop. How would my app connect to the database? Do I need a web server in between? If yes then which web server is used for Android apps? Basically, i want to know the flow of data from app to the database.
Study more from Udacity.com, its free.
You may use a jdbc Connector to connect to database.
Connect your jdbc connector over local network ip\servername and database connection string
You can use REST Service when it comes to web Service on Android like this. You can either pass the values as parameters or an Object depending on your requirement. All the best
Wamp server is best option to play with server related utilities.You can use it even if you are offline. and it provides various option for data storage. It Mainly uses MySql and PHP scripts for fast performance.
For More details Click Here
This post is the continue of my previous question in here. So I had a look into how mySQL works with Java, but I noticed that the computer must have a database server to connect to the application. So what will happen when my software is ready and users want to run in a different computers? Can't I save the database file in the directory of the software, so any copy of the program will be connected to its independent database to save and parse data from it?
Just to make it clear, in a part of my software, I needs to keep record of previous interactions. Like a history table.
Would using JSON a better option in this case?
In a real world generally database servers are installed on a machine and softwares are installed on different machine.
We let software know the database configuration like database URL /database Name /username/Passwords etc (through property file or through JNDI configurationS).Then java program can connect to database with the help of JDBC driver.
Note:- one Database Server can Host many databases.
If you want to distribute your software without having dependency on client database. Then I would recommend you to use some inmemory DB.This DB you can embed with your software.(alternatively you can write logic that if client database can't be found then use inMemory DB..something like this).
H2 db is my favorite one and it also supports persistent mode and it support s many DB dialects including MYSQL .
Im working with a SQLite database right now, and I've made a javaFX application (I will call it the client) that allows me to work with it, but I need to work with it remotely as well. From what I've read SQLite does not support remote acces, so I have 2 choices:
Creating another application in the server that receives input from the client through a socket, and it modifies the SQLite database. (The problem with this, is that the server is a webserver and I dont have SSH access, so I can upload the server side application on the server, but I cant start it...)
(I dont know if this works) Create a java application that runs on the server, and you load it through a browser such as chrome or firefox. From what I've seen java webstart allows you that, but I don't if the app runs on the server or on your computer (meaning that you won't have acces to the SQLite database as well).
If someone here has some knowledge on this pls share, I need to know if I can make this work, and if not, what other options I have.
I don't think SQLite is designed for that. If you use SQLite because it's small and easy, why don't you try JavaDB (derby), it is included in your JDK distribution and you can use it embedded in your app or as a database server (not both of course).
I am working on a project where the raspberry pi (model B) runs JAVA application to connect to and retrieve data from a Router.
What i want to know is the best approach or the best database that i should use to store that data retrieved from the router. Knowing that i will need to build another android application that should connect to that database (on the raspberry pi) and display that data.
So, what database that is compatible with the java application and the android application?
Also, later on i wish i could run the RPI as a server that enables me to connect to that database from anywhere.
Keeping in mind that:
I am new to Raspberry pi
New to Database
I suggest you to take a look at OrientDb is a NoSql Java graph-document db (you can chose) it support a lot of queries paradigm and an Sql dialect as well (you dont have the join), is fast, light, and support native rest query, i have tested it on raspberry pi (even in distributed multi-master mode on 2/3 raspberry node) and it perform well, the nice thing is that allow you to think in a different way, your data is presented like a java object an exposed you by rest paradigm in Json over http so you can think your client application on client side, using html 5 and jscript framework like angularJs for example (and you can 'deploy' your static resource direcly on the db that work like an extremly light application server)
This answer follows the previous comments. Let's say :
You have your router. Connected to it you have PC (with IP address called IP1) and your RPI with IP2.
On your RPI, I guess you have RaspBian. So with the package manager, you install mysql. You create your desired database and tables.
When using eclipse to access your database for testing purpose, or explore all data, I think you need to provide the jdbc driver, and configure the url of the db. Because you are running eclipse on your pc and you want to access the db hosted by the RPI, you should provide the IP2 address in the url.
Because your Java app will run on RPI, you can set the url to "localhost". See the following link : http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html
So, to sum up, eclipse and java app both need a mysql jdbc driver, configured the right way.
Later, you'll want to access your db through your android app. You'll need to configure your router with port forwarding, to access your db from outside. But this is out of topic. I let you search.
Almost All the Databases are Compatible with JAVA.And Hardly I belive that you will not have such privilege to choose Database while develop real time Application .
Java and Android Both are not different , both are same on a Pillar.There will be no problem because of using Database.
i suggest SQLite as Android uses it natively and it does not need that much of resources as other DBMS like *SQL
I was wondering if it was possible to get an SQLITE manager database onto a server? What i mean by this is so that when i complete my program in a java project and make an installer for that project. Anyone who downloads it from any computer running on any operating system who has administration rights can access the database without having connection issues. In addition anyone who logs in to the program can do so with full database connection.
Is there a way to do this? I also don't want the user who is going to install the program to install any additional programs for the database. In addition i would like this program to work on any computer who might not have the SQLITEManager plugin on there firefox web browser or even have firefox installed on there computer.
I would also like the admin to be able to edit anything on the online server the database should be on.
If this is not possible on SQLITE Manager could you recommend a database which can do this but also use and work on the code already made for the sqlite programs?
SQLite databases are just flat-files. What this means in layman's terms:
I download your database as a file.
I can modify it as I please.
I'm not forced to synchronize to the newer version of the flat-file.
You have a choice: You either write your code to force periodic synchronization of the SQLite flat-file to your clients, or you use a dedicated DBMS on your server, such as MySQL, and force your clients to connect to that.