Get the latest Java books
h t t p : / /w w w . j a v a c o f f e e b r e a k . c o m /
Looking for Java resources? Check out the Java Coffee Break directory!
George Reese has taken an unusual path into business software development. After earning a B.A. in philosophy from Bates College in Lewiston, Maine, George went off to Hollywood where he worked on television shows such as The People's Court and ESPN's Up Close. The L.A. riots convinced him to return to Maine, where he finally became involved with software development and the Internet. George has since specialized in the development of Internet-oriented Java enterprise systems. He is the author of Database Programming with JDBC and Java and the world's first JDBC driver, the mSQL-JDBC driver for mSQL.
In this exclusive interview, we talk with George about database programming in Java, and the Java Database Connectivity (JDBC) API.
Q: What do you see as being the biggest change affecting the Java community in the last year?
A: I think the beauty of the last year has been the lack of significant change. Java has spent the last year maturing across all of its APIs. As a result, you see a lot of the old arguments -- performance, stability, etc. -- against using Java going away. I think that is exciting.
I think the most interesting frontier arena for Java, however, is Jini. It seems to me most people have a limited picture of what Jini is when in fact it is a tool that demands some out of the box thinking. When people start truly thinking outside of the proverbial box with Jini, you will start seeing some fundamental changes in the way we use Java to build software.
Q: How do you find Java stacks up to other programming languages, such as C++ or scripting languages that are used to provide quick interfaces to a database?
A: I am of the opinion that there are only three important languages:
Python and C++ are niche languages with Python supporting scripting needs (the realm traditionally reserved for Perl) and C++ for extremely low level programming tasks. Java is there for everything else.
I believe in using Python for scripting that needs to talk to a database, and Java for everything else. Java works so beautifully for database programmers primarily because of tools like JDBC that really minimize the need for a database programmer to have to know the specifics about different database engines. If you know JDBC and SQL/92, you have the tools to write solid database applications against any database engine. While other APIs such as ODBC attempt to provide this power to other languages, the fact is that they lack to simplicity of JDBC. And they do not provide any meaningful extra functionality that one would expect from added complexity.
Q: For the database novice, what exactly is JDBC?
A: JDBC is a database-independent API for access to a relational database. You pass SQL to Java methods in the JDBC classes and get back Java objects that represent the results of your query. It is designed in such a way that most database programmers need learn only a few methods in just three classes to do most of what database programmers need to do to accomplish database programming tasks.
Q: What type of database would you recommend for the entry-level Java programmer who is learning JDBC from your book? Is the choice affected by the availability of JDBC drivers?
A: MySQL. The temptation is to use Access since it comes with some versions of Office. The truth is, most people have a hell of a time getting Access set up and configured because of the ODBC bridge people use to talk to Access. MySQL, on the other hand, has several network drivers. It also looks more like a "real database", so the knowledge an entry-level programmer gets from it is more applicable to real world applications. Finally, it runs on Windows and Unix, not just Windows machines.
Q: While JDBC is certainly useful for interfacing with external databases, are there many 100% Pure Java database packages out there, and how do they compare to their native cousins.
A: The terms 100% pure and native are a little deceptive when talking about JDBC drivers. The 100% pure drivers are often what are called type 3 and type 4 JDBC drivers. Type 4 drivers are often referred to as "native" drivers because they use the native network protocol of the database engine they support, not any native code in the pure Java sense.
Type 1 and type 2 drivers are native in the pure Java sense. That is, they generally use a C API or something similar to talk to the database.
For server-side applications such as EJB middleware and servlets, I recommend using the type 2 drivers. These drivers use the databases native C API to talk to the database. These drivers provide the best performance, but they are painful to deploy.
For client applications, such as applets and two-tier Swing apps, I recommend a type 4 network driver. These drivers have 100% pure Java portability. I recommend never touching type 1 or type 3 drivers--two different types of bridging drivers--as they rarely have any tangible benefits but come with plenty of headaches due to their complex architecture.
Q: When developing JDBC systems, would you recommend a particular development tool (such as a database design package), or should programmers stick with SQL for creating their tables?
A: I am a strong proponent of disciplined software engineering. As such, I think developers should never just enter in SQL for creating tables. The data model should be drawn and documented somewhere. Now, that does not mean you need an expensive modeling tool. Drawing a data model on a piece of paper (or a whiteboard as long as you save the drawing somewhere) and then writing a SQL script is totally acceptable.
Q: Looking to the future now, where do you see Java heading? Is there a particular technology that you're enthusiastic about?
A: As I mentioned earlier, I am very interested in seeing where the development community takes Jini. Beyond that, integrating a JSP-like technology with solid content management technologies should be really important to changing the way Web applications are built. The problem now is that JSP is not a very good technology and existing content management technologies such as Vignette and Open Market are even weaker.
Q: Thanks for talking to us George. George's latest book, Database Programming with JDBC and Java, Second Edition, is available from all good bookstores, and online from Amazon.com.