9Working with Databases in Java

WHAT YOU WILL LEARN IN THIS CHAPTER:                

  • Basic concepts of relational databases
  • Key problems when working with relational databases in Java
  • How to use JDBC and SQLJ
  • How to use an object relational mapper like Hibernate
  • How to use object-oriented databases
  • Key advantages and disadvantages of different approaches

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/go/beginningjavaprogramming on the Download Code tab. The code is in the Chapter 9 download and individually named according to the names throughout the chapter.

Many Java applications need to either retrieve, update, delete, or store data. In Chapter 8, you discovered how files can be used for this purpose. For small applications, it is definitely possible to use files for data storage. However, for larger-scale applications, the file-based approach to data storage and management creates several problems. First, since every Java program needs to explicitly define the structure of the file, a strong dependency is created between files and Java programs. In other words, the Java program is strongly tied to the physical representation of the file. This creates substantial maintenance issues when the files are being accessed by multiple Java programs simultaneously. For example, when the physical storage structure of a file is changed, such as distributing its content over a network, all Java classes working with the ...

Get Beginning Java Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.