Hello All, Can anyone recommend a book or links to the web, which could help me with a Front End Swing Client-Back end Database Server application. In GUI development I have used VB style, where one can easily put everything in the GUI front end. I need pointers in writing an application that uses Object Oriented Techniques, for example creating containers for database and classes for database access. Because I assume that is the correct way to do it, especially when using Swing. Thank you all!! Zulfiqar
If you are trying for client-server, you need to decide how you are going to design it. RMI? or using a CORBA tool etc. In addition, you probably don't want to create a database yourself (Well there are SOME folks out there who might. . .) so you just need to decide what database (Access, Oracle, DB2 etc) that you will use, and set up some JDBC access. Are you sure you just want client server examples? Is there something wrong with applets or servlets? For lot's of code examples take a look at: www.javaboutique.com
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Oct 18, 2000
Thank you for your reply. I will check the link out. It is a client requirement for me to work with JFC Swing front end and access an Oracle/SQL Server/MySQL server at the backend. I would be using Swing at the front-end and accessing my database through JDBC. Would I need RMI? as I plan to put the SQL statements in objects at the client side. These objects would use SQL calls using JDBC to retrieve server data and poplulate my Swing widgets. Would there be some problem with this architecture?? My concern is that I am used to VB style putting everything in the GUI. It will be new experience for me to put all the the logic in objects accessing back end databases and populating Swing Widgets, and I need some references to help me with this. thanks zulfiqar
Joined: Sep 29, 2000
No, what you are describing is NOT a client-server relationship necessarilly. It could be a two-tier architecture. The application could reside completely on the client, with just SQL calls to the database using JDBC. No code NEEDS to be on the server. If you DO decide to put part of the application on the remote server, then YES you will need RMI or something to get the two parts to communicate. An alternative is to get a CORBA tool to broker the objects between the client and the server and the database. That part is a design issue. You can look in the JDBC forum for snippets of code for the database calls. Check out the RMI forum and see if that is what you really want to do. Meanwhile I'll see if I can find SOMETHING for you to look at. It is really hard to find an entire application that can be shared.
Swing makes is pretty easy to separate your model from the GUI view. Most Swing components are actually views on a model you can specify. What that means in practice is that you will code your model, then decide how it needs to be viewed. The documentation for the viewing component will tell you the data type (interface type) for the component's associated model. You then go back to the model class and have it implement the interface. For example, your model may have classes Customer, Order, and OrderCollection. The orders associated with a customer would be given in an OrderCollection object associated with the customer. So, if your GUI needs to list the orders you would have OrderCollection implement ListModel (meaning you would implement the three or four methods required by ListModel). As a result, you can assign any OrderCollection object to be the model for a JList. So -- focus on good separation of the model, then read-up on the various models used in Swing. Good luck!