It is never too late to become reasonable and wise; but if the insight comes late, there is always more difficulty in starting the change.
I began writing the first edition of this book in May 1996 as Java™ celebrated one of its first major rites of passage, the inaugural JavaOne conference. The conference’s underlying theme was Java’s transition from an applet language to a hard-core computing environment. In the time since that conference, that promise has become a reality. This book captures a small piece of that reality: Java as a language for enterprise computing.
Enterprise computing, a vague term used mostly to sell business systems development products, traditionally refers to the mission-critical systems on which a business depends. It almost always includes a database. At the heart of Java’s enterprise computing philosophy is the Java 2 Enterprise Edition (J2EE) platform and its two platforms by APIs: Enterprise JavaBeans (EJB) and Java Database Connectivity (JDBC). Older languages require third-party APIs to provide this kind of support. Java, on the other hand, includes these features in the central Java enterprise distribution that you will find on every Java platform. As a developer, you can write distributed applications that run against relational databases and know that those applications will run on any system on which you deploy them.
What exactly are these APIs? JDBC—the basic component of this book—enables you to write applications that access relational databases without any thought as to which particular database you are using. If you have ever had experience programming to more than one database API, you will definitely appreciate this aspect of Java. When you write a Java database program, that same program will run against Oracle, MySQL, Sybase, Ingres, Informix, mSQL, PostgreSQL, or any other database that supports this API.
EJB, on the other hand, gives real meaning to the expression “the network is the computer.” If you have written Internet applications in the past, you have probably been faced with the challenge of writing TCP/IP or UDP/IP sockets. While socket programming in Java is not nearly as hard as it is in other programming languages, the task of writing sockets is generally a side technical issue that takes time away from the writing of your main application code. By using distributed object technology, you can build Java objects that run on different machines but communicate with one another through simple Java method calls.
How do these APIs make Java more than a simple applet building language? Database access is the core requirement of the majority of mission-critical business applications that get developed. By giving Java database access combined with the development of GUI development tools, Sun has made Java a language that competes with established tools, such as VisualBasic and PowerBuilder. Java distributed object support goes a giant step beyond these tools by liberating Java components from the need to be located together in the same Java Virtual Machine.
If you have not yet read a book on Java, then this book should not be the first one you pick up. I assume that readers have a basic understanding of the Java programming language. Specifically, you should feel comfortable with the basic syntax of Java and central concepts such as classes, interfaces, and packages. If you are looking for a starter book for Java programming, I strongly recommend Learning Java by Patrick Niemeyer and Jonathan Knudsen (O’Reilly & Associates).
I also expect that you know some basic database concepts. You do not need the same solid foundation with database concepts that I assume for Java. Instead, you should have some minimal exposure to relational databases; you should know what tables, columns, and rows are and understand basic SQL syntax. I do provide a basic introduction to these concepts in Chapter 2 ; however, this introduction is very quick and certainly skips a lot of important details. While Chapter 2 does not provide nearly enough knowledge to make you a database expert, it will serve you well if you intend to study databases while using this book. If you are truly green to the database world and really want to dive in, I suggest downloading a copy of the MySQL database at http://www.mysql.com and purchasing the book MySQL and mSQL by Randy Jay Yarger, Tim King, and myself (O’Reilly). MySQL is a simple, accessible database engine that serves as a perfect learning tool.