Share data on local - java

I've made an application for someone, with Netbeans (java) using mySQL.
Well, when I'm about to install it in his office, but it told me that it's impossible to host database!!!!
SO I have to modify the application, but I'm not sure what to do; if you have a suggestion for me; i'll be greatful
It's a java application, which is supposed to be used by several users, who share a little database.
Thank you beforehand

If your application is reliant on a database to work properly I would maybe ask them if remote hosting a database is an option they can consider if "in-house" database is off the table. If your application however is not reliant on a database you might want to look into serialization where you can save it on a file instead, check out http://www.tutorialspoint.com/java/java_serialization.htm. However it is hard to answer because you dont really describe what your application does.

Related

Is it possible to create and schedule a background task in Java Hibernate/Spring MVC Web application?

I have been assigned to work in a project which was built by another developer. It uses Hibernate/Spring MVC technology in Java with MySQL is database server.
Previously, by the time the project went live the first time, there was not much data, so the performance was fine. Now our client is expanding their business. A lot of data was imported and thousands more will soon be imported. Many features in the website require multiple database transactions based on user input. Performing a lot of database operations each time they navigate between pages is nightmarish to them.
I'm thinking of declaring some static variables, then creating scheduled tasks to automatically load data into the variables so they can be used globally. I know how to do this with a desktop application but I don't know if it is possible in a MVC web application. Can anyone please help me? Thanks.
UPDATED: Another thing I forgot to mention is new data will be imported by our client's side everyday. I've made some analysis and see performance improvement can hardly be achieved via cache. The only solution I can think of is through background tasks but I'm not sure how can I achieve this.

Java - Network application- Real-Time

What are recommended strategies for building Java application that will be run on "desktop", not in browser. Characteristics of the application would be:
1. Multiple application instances would be running on different machines
2. Applications must communicate in real-time (if one user make changes,
in another application data must be refreshed)
Do you want to create a networking application maybe? based on sockets and so on? Regarding your 2 questions, I have implemented that scenario some time ago and I am working in something similar for my job, it is not complex at all, but I will answer to you according the two issues that concern to you.
Multiple application instances would be run on different machines.
If you are going to install an instance of the application in the people's desktop, I'd suggest to be very careful with "paths", do not hard code any path, since the resources loading will be dynamic.
Check carefully what is the network architecture in which your application will be installed. Maybe it is just a LAN, or maybe it will work in a big network and access through VPN, etc. Check what is the scenario.
Once you make sure your application works fine in different machines without any path conflict or resource loading conflict, you can export your jar, generate it using maven, ant, etc.
Also, if you want to move forward, you can create an installer using any Install wizard creation and create a batch file (.exe) for Windows or (.sh) for Linux distr. But these are only suggestions for the installation stage.
On the other hand, if you wanna execute the application as a Java desktop but using an URL to launch it, you can take a look to JNLP.
Applications must communicate in real-time (if one user make changes, then other will be able to see that)
If you want to do that, you will need, for sure, a server to provide and store information. The server can be a physical machine set up in the office or a remote one.
You have two options here:
Use Java Networking: Create an application that works as a server that provides and saves the information (it should be a concurrent environment since many people will perform transactions or queries over it). Check how can you create a basic server - client application using Sockets to understand better how it works and then you will not have problems to add the complexity of the requirements your environment demands.
You can simply, develop a Java REST Based application and make your Client application connect to the machine (or machines if you plan to implement load balancing) and consume those REST. You can take a look to Jersey libraries in order to implement your scenario. Make sure to add security to these Web Services and make the server private access for the network in which your application instances will work.
Well, that's what I can tell you regarding the scenario you try to implement, based on what I've done and what I'm doing now so far.
Maybe if you need additional or further information, you can reply in the comments, and it will be great to help you.
Regards and happy coding :)
you want to look into using sockets, TCP or UDP, and also figure out if you want a central authoritative server ( what if two users change the same thing in different ways, whose data is saved?)
read this article from Oracle/Java hereJava Custom Networking

Synchronizing local database with remote database and vice versa

I am developing a web application with php that needs to synchronize a local mysql database that a java desktop version of the web application is interacting with. At the same time i also need the local db to synchronize with the remote db. How do i do this without using other software like MySQL Compare. I will really appreciate the help. Thanx guys.
You clearly have a significant architecture issue. It needs to be planned very well. Two-way replication clearly isn't going to work unless you have thought it out very carefully and understand how to do conflict resolution and what impact that will have on your application. In particular, you can forget using AUTO_INCREMENT.
For one-way replication, you can use mk-table-sync, or use mysql replication in some way (there are a variety of possiblities).
You can also run another mysql instance on the server, use mk-table-sync to periodically synchronise it locally, and use mysql replication on that. This has some benefits, particularly if there are some tables you don't want to replicate.
You really need to think about how it's going to work, if you plan to do two-way synchronisation. It is possible that you may end up writing custom code to do it, as the conflict resolution mechanism may mandate it.

Simple middleware server for control and monitoring

I need a server. A simple one, to control a couple of computers. There are already a couple of programs in the lab, that perform some calculation and monitor tasks. They are executed on these computers. So I need a server to control them - to see the real time data from these computers, I want these programs to upload the calculation data to the server, upload also some files, that come together with this data. So the server needs to have a simple database. I also want to alter some of the calculation parameters in the realtime.
Because, you see, I'm a little tired of opening each computer with the terminal, looking at the process, get the files from each of the computers by ftp, put these files in the corresponding folder on the file storage, writing the schedule, when each program should continue it's work.
Maybe there is some middleware, that I can use for such needs? It should be simple and extensible. i thought of writing such server from scratch, it is not a big problem, but I have a severe time shortage and many other things to do.
And it would be cool, that this server would be developer-friendly. So I could just take it's API and write whatever I need.
I'm using Java, so it would be great, that this server would also "understand" Java. ;-) RMI is cool, but because of the network architecture, I'd prefer to use plain TCP/IP for these needs. Becacuse there is always problem with setting up RMI, when there computers are in differed subnetworks.
Thank you very much for your support in advance! Please help me, otherwise my girlfriend would break up with me, because I don't see her often spending most of my time at the lab... ;-(
I am almost finishing a software like that (actually 3 softwares) the server, the clients and the admin that logs into the server and command the clients.
My problem was specific so I had to go for a custom build from scratch (TCP/IP sockets). Its not hard, just write down the protocol.
If RMI doenst help you, then you must consider making your own proto, and you could exten and add new features later.
Maybe Google Protocol Buffers would help you to build your proto
http://code.google.com/p/protobuf/
Hmm, the two that spring to mind are Jetty and Glassfish. Depends a lot on what you need to do and how you want to go about it. Both are java based.
This seems like a problem for which Bundle-Bee was created for.

Where to store data gathered by applet?

I am writing my first real applet and I need to store some data. I've never really messed with putting and maintaining code on the internet, so please bear with me if I'm a little slow to catch on.
I'm building a Calendar applet for work (just a student worker) and I'm not sure how to store necessary information such as the schedules for certain days and login name and password information. I assume I have access to a server and such, but I don't know exactly what I would traditionally need or what I would need to do with what I need.
In the worst case scenario, I could simply put the information into text files and read them on every start-up where the applet is stored, but that definitely seems like a very wrong way of doing things. Can you guys educate me on a few practical ways people accomplish this in the real world. Any ideas would be greatly appreciated. Options that are free/open source would be best.
Thanks a lot for your help.
For this sort of small application, I would go for SQLite.
How about a relational database such as SQL Server ? Maybe access?

Categories