Integrating middle tier between Java Desktop Application & MySQL Server - java

My Current application working in network environment, each user run the application from their desktop to connect to the database server.
Since, the application dealing with many transaction that accrued from multiple station during working day, I would like to ensure there will be no confectionist within same record, since the data shared between all stations & each employee working on these records.
The application working as ERP solution there will be many kind of transaction for (Receipts, Payments, sales, purchases, etc).
For that I need to make sure there will be no transactions could be edited from two users at same time.
I searched the internet for solutions, what I understood:
- Applications deals with 3-tier will achieve this approach.
- Applications should run as client server using web server.
My Client: Java Desktop Application SE Thin Client.
My Server: MySQL Database server.
I don't want to go web application.
What i need to achieve this?
What is could be used to get functionality as 3-tier.

Replace Apache with Jetty which is an embeddable web server built with
java. Jetty can serve php pages if it's linked to the php executable.
MySQL is not a great option for this at all - if you need a portable
high powered solution use MongoDB which you can simply package and run
alongside your application.

Related

Java Swing using Socket for enterprise application

After several months of searching & reading, now i need your help, taking in consideration the following:
- My Application Developed using Java Swing.
- MySQL has been used as database.
- JDBC has been used to make the communication between the application & database.
- The application will run on network environment with multiple client will connect to database.
- The application use Financial transactions, Posting, Billing ... etc.
** now i want to develop a server side that will work as middle-ware, this server side will do the following:
- Connecting to the database to retrieve data as client request.
- Business logic will be on the server side.
- Client will not know about the database.
- Queries Syntax will be on the server side.
- The Client will View,Save,Edit, Cancel ... etc, sending these actions to the server side & server will response.
--- I have read about JFC, J2EE, EJB ... etc, but i don't want to run my application from browser, it will be kept as desktop application only due to the complexity of the application.
--- So i will do it using Sockets.
Any ideas, or tutorials that i can follow?
I suggest using a web-based approach to writing the back-end (e.g. a web service, either SOAP or Rest), and then communicating between the swing app and the back-end app via HTTP / HTTPS.
This is how mobile apps are typically written, and your swing desktop app is no different from a mobile app in this respect.
As far as frameworks for the back end, both Spring MVC and Grails make this pretty easy. Do yourself a huge favor and stay away from EJB unless you really need.it and understand why.
When you have 1-2 hours left, it might be worth to look at the Scout framework.
Scout seems to be a pretty good fit to your application context. Scout applications consist of a Scout server that handles access to web services (currently including support for JAX-WS) and database access over JDBC. The Scout client communicates via HTTP(S) with the Scout server and is available in the form of desktop clients (either supporting Swing or SWT) and as web application (currently based on Eclipse RAP). The web client also supports different renderings to optimize the application to desktop browser or mobile devices with touch support.

Prevent reaching database from outside of web application

I am developing document management system as a web based application using java technologies. I have to prevent database access in any way except this app. None of way can not update any table on this system such as directy using a sql query. This kind of sample is SAP.
AS I guess, SAP company has a middle tier structure and there is not any way to manupulate any data. It allows only using SAP gui and transcations mechanish to alter, create or delete andy data.
My app has many user rights to do any thing on the system and I have to guarantee that data can not bu changed on database except this application.
What I want to do is this kind of architecture. Can you give me some idea, how can I achieve this for my application?
Thanks
You need to program two applications: A client application and a server application. The client application is installed on the users machine and communicates with the server application installed on a server. The server application then communicates with the backend database.
There are many possible ways to do this.
It's your decision how much business logic you want to have on the server and how much you want to have on the client. It can be anything between the server being not much more than a proxy for the database while the client does everything or a very thin client which is just a dumb GUI with the whole logic running on the server (that would be what SAP is doing).
There are also lots of options for communicating between client and server.
Listing all possible options would be too much for a single answer.

How to create objects in server application and be able to call them from client application

I am learning to program Java. My objective is to create client server application based on Java and MySQL.
That would have following.
Server Application where all admin controls would be available to configure.
server application will be the only to have access rights to MySQL.
Server will have all functions and objects that clients will require and call and get that functionality. (Reason for that is "I don't want to share MySQL credentials to client apps or rather i don't want MySQL credentials to be transmitted on the network to clients"). As it would increase maintenance tough and it could be a security loop hole.
An analogy of functionality could be: client calls to server telling to add an Order such addOrder(order_id, payment,..,...,..) and so on.
What are the method in practice for such kind of application these days? A example code/or material to get in right direction would suffice
These days the universal way to expose a service remotely is via a web service. This solution was preferred by the industry over time due to its simplicity and ease of integration to the point that binary based protocols like CORBA are now seldom used.
Take the example of Android applications, they are native application mostly using REST web services.
A REST web service can be easilly integrated in the same way with a desktop application, a mobile application or a web application, even if the clients are written in different native platforms and languages.
As sample code, have a look at tutorials on the Spring stack. For the server see this tutorial for building an hello word REST web service. For the client, consider the REST template.
For security, see this Spring security hello world example. Using the Spring stack in Java will likelly give you the largest number of tutorials and online support.
This sounds like a good place to use RMI, which Java has built in support for. RMI will allow your client to call server-side methods on a local object that corresponds to the server, where all messages/commands get transparently sent to the actual server, where you have your DB access stuff and logic.

Java application vs web service vs web application

I am developing a multi-platform (Android, iPhone, Windows and Blacbberry) mobile application. The application needs to communicate with our server for several tasks, such as retrieving buddy lists etc. The server interacts with data that is stored in a MySQL database. I intend to code the server element in Java, however I am confused by all the different types. So far, I think I have narrowed it down to three options:
1) I code the application using Jetty to accept http posts. I post XML to the server, handle it, interact with the DB and post a XML response back. I would save the application as a jar and leave it running on my server.
2)I develop a Java web service. REST/JSON/SOAP?
3)I develop a Java web application.
Whilst there are many questions already out there asking what the differences is, I am struggling to find a clear explanation as to what is the best approach in which situation. I have previously used the first approach but am assuming the second approach is the better option, I'm just not sure what the advantage is.
your 1-3 options are all variants of a "Web application".
Jetty is a Java based http server/servlet container. If you want to communicate between client and server using http, you are using an http server (although not necessarily Jetty).
A Web Service is part of a web application that conforms to a standard around how clients communicate with the server, and how the server offers up information to the clients.
A web application is a Java application that makes it services available over http.
So if you want to have your clients communicate with a server, and store info in a db, you are using a web-application.
I would recommend going with option 2 as it is more lightweight and can be parsed directly in you're web application. XML got more overhead and must be translated, while you can just serialize objects directly to JSON from you're Java application and then parse them in javascript at frontend

linking my java web application to the web?

I am beginner java web developer, now my question is after i developed my application, how to make users see it on the web?
I used JSF,MySQL and GlassFish server in my development stage and now i want to publish it.
I got a domain name and an a web hosting account on goDaddy.com
In other words what to do after i develope my web application?
what steps should i take in server creation and other stuff?
I have searched alot but there is no specific way for it. I am trying to make this dynamic website based on jsf development--and it is already done--become alive and out their like any other web site?
any guide lines and steps should i take in making this steps ?
Either you will need a "Production" server to host the application yourself or use a hosting service of some kind that provides a Java EE container. If you're tied to Glassfish, you can Google for those providers like http://glassfishhosting.com/.
Other options that might be good fits for you are cloud services. Something like either Rackspace or Amazon EC2. Each has their own pricing tiers that scale based on usage. Good luck to you going Live!
Can host the code on Github and push it to Heroku.
http://devcenter.heroku.com/categories/java
I don't know the provider you chose but you need a java application server for your live environment. And optimally this should be the same server as your development server.
For our projects we buy a virtual server and install Glassfish on it. This costs around 15 € per month and we have the same environment for development and production.

Categories

Resources