13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

316Chapter 14Storing the Data14.2FOLLOW THE OBJECTSOne of the c<strong>on</strong>sequences of a good object design is a relatively simple databasedesign. For the most part, each class will end up as a database table where eachrow represents an instance of that class. Bey<strong>on</strong>d that, all that is needed are thosetables required to represent relati<strong>on</strong>ships between objects.In this chapter we will show you examples of these relati<strong>on</strong>ships, and wewill do so in a manner that should easily port to any SQL relati<strong>on</strong>al database.14.3OF PERSISTENCEPrograms cannot be assured of running forever. Virtually all computer mainmemory (i.e., RAM) is volatile, meaning that if the power is removed, the datais lost. Since computers are sometimes rebooted, and since the power sometimesgoes out, we obviously need some place besides memory to store our class instances.We need persistent (n<strong>on</strong>volatile) storage. This can be as simple asstreaming our classes out to flat file, or it can be as complex as a clustered multiuserdatabase. We will discuss the selecti<strong>on</strong> criteria and how you might chooseyour persistent storage strategy.14.4THINKING OF THE FUTURE, OR PAINTING IN CORNERSIt is important that you try, in your class design, to avoid making the persistencesystem dependent <strong>on</strong> a particular storage method or product. If you dothis, you can switch storage products or soluti<strong>on</strong>s relatively easily.14.5ORACLE, POSTGRESQL, MYSQLOne of the first major decisi<strong>on</strong>s you must make is what to use as a databaseserver. On <strong>Linux</strong> systems, you have both Free Software and commercial softwareopti<strong>on</strong>s. As we have said before, we will tend to focus <strong>on</strong> Free Softwarein this text, but we cannot ignore the most popular database software packageout there, which is, of course, Oracle.Let’s take a quick look at each of the “big 3” database choices <strong>on</strong> <strong>Linux</strong>platforms.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!