Forum Stats

  • 3,875,873 Users
  • 2,266,977 Discussions
  • 7,912,362 Comments

Discussions

How to connect a Desktop app to a middle teir server app?

843810
843810 Member Posts: 46,938
edited Mar 4, 2010 10:58AM in Java Desktop Applications
Please tell me if i have posted this in the incorrect forum.

I currently have a Desktop app that connects directly to a mySQL database. The persistence abilities have been really helpful since our database is still evolving. I have been frustrated by the differences in the SE persistence implementation. I have had to do some hackish things to ensure that the app retrieves the current information. I don't like connecting directly to the database from the desktop app, even though security is not a worry. I have been thinking that the best solution is to have a JEE app running that the desktop app connects to. This also would act as a sort of api for accessing our data, so if and when i create other client desktop apps i don't have to recreate the wheel. From what i gather i will want to run an application server such as tomcat or glassfish. I'm not sure if i understand why though. Since i have control of the server, couldn't i directly open ports for communication to the clients?
Assuming that there are many ways to pass information between them, advice on the most effective would be nice. I'm guessing serializing objects for passing would be the fastest, but using something like XML, would be a lot easier to monitor.

Although i have done a lot of reading, i'm still baffled by the EE lingo.
EJB: kind of like a modular program that facilitates server to server communication?
JSF: package up stuff for viewing/ running an application through a browser?
Servlets: Mystifying, which leads me to think that they are what i'm looking for.

Any advice would be helpful. I'm hoping that there is not some type of restriction in regards to connecting a JSE6 app to a JEE6 app. I basically want to have the best of both worlds.

Thank you,
Chip

Comments

  • 843810
    843810 Member Posts: 46,938
    edited Mar 4, 2010 3:16AM
    Chipper wrote:
    From what i gather i will want to run an application server such as tomcat or glassfish. I'm not sure if i understand why though.
    If you have a middle teir, you imply that you want frontend and a backend also, the function of the middle teir is to insolate and abstract the backend from the frontend. This is the significant difference from what you have now: client server--frontend and a backend.

    The middle tier, as you have implied, is where you put your access to your backend. And, yes, you are creating an interface to your DB there, wherein you will develop an entire API for accessing your DB. This will give you added security by not letting your clients know anything about your backend.

    Now, how do you access this middle tier? There are several options there, but a few options are:

    1 - Running direct socket communication

    2 - Web Services: code ran on the server to extend the functionality and open services on the middle tier.

    3 - Applets: code ran in the browser on client side to access the server and it's services.
    Assuming that there are many ways to pass information between them, advice on the most effective would be nice. I'm guessing serializing objects for passing would be the fastest, but using something like XML, would be a lot easier to monitor.
    At this point you are the only one that can answer that question: there are arguments for an against most method that could be picked. Let's take for instance an object that contains 1 usable byte of data. Is it better to serialize the object for that one byte? Send XML to a DB? Or, perhaps, just send the byte of info and synthesize appropriate key information? You have to look at what you are trying to achieve and your requirements.

    Even a scratch of the surface discussion is not possible here, let alone, a howto on implementation for your enterprise. I suggest hitting the tutorials and finding a good book.

    Do you have specific questions? Ones that can be answered in a paragraph or two.
  • 843810
    843810 Member Posts: 46,938
    Thank you morgalr.
    I think you have put me closer to the right track. So my current plan will be to create a J6EE application that runs on the server, that handles access to the database. I'm still a little fuzzy when it comes to the role of an application server. I'm going to do some more reading on it. Any suggestions on JEE books and tutorials are welcome.
  • 843810
    843810 Member Posts: 46,938
    edited Mar 4, 2010 10:58AM
    The application server is the base for all communications to the "middle tier". It supplies the communication framework to allow you to hang your J6EE objects from. When you check closer into development, you'll notice that much of your base functionality--communications, security, and etc... will be taken care of by the application server. You'll be writing code that will augment/extend the functionality provided by your application/web server.
This discussion has been closed.