Java Reference
In-Depth Information
Working 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 possi-
ble 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 represen-
tation 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 file would need to be updated. Likewise, when changing its internal content and/or repre-
sentation, such as by adding, deleting, or changing data elements, changes need to be made to
all the Java programs that access it. Moreover, in a multi-application distributed environment,
many files will contain duplicate data, which obviously not only implies a waste of storage
 
Search WWH ::




Custom Search