Preface

“This—is now my way: where is yours?”

Thus I answered those who asked me “the way.”

For the way—does not exist!

Zarathustra, in Thus Spoke Zarathustra—Friedrich Nietzsche

I’ve been working with the Oracle database, at Oracle, for more than 15 years now but for the last six years, I have been serving as group product manager within the Java and Web services products group, part of Oracle’s server technologies development organization. Like Janus, the Roman god, I have to face two opposite directions: (1) the development organization, to represent customer interest (e.g., requirements, application design choices) and (2) customers, to represent the development organization (e.g., features, implementation design choices). Working closer to both worlds (i.e., customers and developers) gave me a very broad and sound knowledge of the products, how customers are using them, and ultimately what customers want. This book is my attempt to share this experience with a larger audience and provide a practical overview of Java and Web services technologies (APIs, products, and utilities) that are embedded within or gravitate around the Oracle database.

When I submitted the draft of this book to my publisher, I proposed the following title: 360-Degree Programming the Oracle Database with Java and Web Services. The final title lost the “360-degree” reference, but this is the spirit of the writing. The audiences of this book are (1) database developers—a community that includes DBAs, stored procedures developers, JDBC applications developers, persistence frameworks developers (i.e., OR Mapping, JDO), and data architects[1]; (2) Java developers who want to get the most out of their RDBMS; and (3) Web services assemblers (as you will see, you don’t develop Web services, you assemble or turn an existing component into a Web service). The book describes simple techniques accessible to non-Java audiences such as DBAs as well as advanced techniques for experts and power developers. The Java community has already developed tons of Java libraries and code samples; therefore, you don’t need to reinvent them or be a Java expert or Web services guru to wrap existing libraries, applications with SQL, or bridge Web services and SQL. You won’t need to dig into the mysteries of Java programming or SOAP programming.

The techniques are powerful, as with minimal effort, you will instantaneously add new capabilities and fully exploit all the potential of your Oracle database and RDBMS in general. The techniques are cost effective, as these will help you save development time and, more important, costs.

After practicing the samples in this book, DBAs and database developers in general will add Java and Web services to their skills set and contemplate their next move with confidence; Java/J2EE applications developers and Web services assemblers will broaden their scope and build applications that straddle both the middle tier and the database tier; and finally infrastructure developers (e.g., J2EE containers and OR mapping frameworks designers) will get advanced tips and insights for building more efficient persistence and datasource layers.

The ability to run Java in the database is not a new concept; it has been available in the Oracle database since the release of 8.1.5, and also in other RDBMS such as DB2 and Sybase. However, J2EE in the middle tier has eclipsed Java in the database, partly because some vendors, such as Oracle, have earlier trumpeted J2EE support in the database and then, realizing that the J2EE programming models (EJB, Servlet, JSP) do not fit well within the RDBMS, smartly changed their strategy.[2] This abandonment of J2EE in the database leads the public to think that the baby has been thrown out with the bath water (i.e., dropped entirely Java support in the database). Fortunately, Java in the database is well alive and being adopted by a growing number of database developers as an open language for stored procedures, as validated by the following survey.

Evans Data Corporation conducted a survey in Winter 2004 on database development and found that 46% of database developers like Java in the database because it offers the choice of a standard procedural language for database packages. Another 43% of database developers are attracted to Java because of the large pool of programmers now available. Skills can be easily redeployed from project to project. Another benefit is the reusability of the applications, as cited by 41% of respondents. Forty-one percent also cite the flexibility by which Java code can be run on any tier of the IT infrastructure.

I will show you that beyond tactical use for stored procedures, Java in the database allows you to bridge and glue database capabilities with J2EE, Web services, and ERP. With Java, you can turn your database into an agile and extensible data logic server.

If you Google “Java persistence,” you will get more than 700,000 hits. Java persistence accounts for a significant part of the Java/J2EE applications development effort. Simply put, there is no enterprise Java application that does not involve persistence, and usually using an RDBMS. There are many choices of APIs and design patterns, including JDBC, SQLJ, Data Access Object (DAO), Java Data Object (JDO), EJB CMP, POJO, OR mapping, POJI (even MOJO[3]), and so on. There also are tons of products, frameworks, and utilities. I will distinguish between explicit persistence mechanisms (i.e., SQL-intrusive or “do-it-yourself”) and transparent persistence mechanisms (i.e., non-SQL-intrusive or “do-it-for-me”). Transparent persistence refers to mapping, storing, and retrieving the states of complex Java objects and object graphs to relational tables without the explicit use of SQL-intrusive API such as JDBC or SQLJ. Transparent persistence mechanisms ultimately generate JDBC/SQLJ and are used by those who do not want to deal directly with JDBC or SQLJ. It is mandated by Container-Managed Persistence EJB, POJO, and JDO design models and implemented by OR mapping frameworks such as Toplink, Hibernate, and so on. A discussion of this topic is beyond the scope of this book.

Explicit persistence refers to storing and retrieving the states of Java objects, mapping SQL types to and from Java types in procedure parameters and function returns, and using JDBC, SQLJ, and related utilities such as Oracle’s JPublisher. It is used by stand-alone J2SE applications, J2EE components that handle persistence directly (i.e., Bean-Managed Persistence EJB), and under the covers (i.e., through code generation) by the transparent persistence design models or frameworks mentioned previously. I will show you how to take advantage of new and advanced Oracle JDBC features, how SQLJ simplifies JDBC programming, and how JPublisher simplifies overall database programming.

Beyond persistence, Java SQL data access must also face a set of new requirements in terms of managing database connections in clustered databases and enterprise grid computing[4] environments such as load-balancing of connection requests and high availability. These requirements can be addressed either programmatically at the application level—you don’t want to do that!—or at the application server level (i.e., J2EE containers, Java frameworks)—this is currently the norm—or at an even lower level (i.e., the JDBC drivers). I will describe how the new connection services in Oracle Database 10g JDBC address these requirements.

RDBMS vendors are also adding Web services support to their databases. A couple of years ago, I humbly coined the term “database Web services”[5] to designate the new trend of accessing and manipulating a database through Web services protocols. The Evans Data Corporation survey (mentioned earlier) also found that “more than two out of three respondents, 68%, say they are in the process on exposing or invoking their database operations (including SQL query, DML and stored procedures) through standard Web services mechanisms.” What are Web services and what can you expect from their integration with the database? I will provide an overview of the core technologies that are part of Web services and describe in detail the emerging concept of database-related Web services with practical examples. I will provide concrete examples of turning your database into a Web service provider and consumer, and also how you can turn your database into a first-class citizen of a service-oriented architecture (SOA).

Programming the Oracle Database using Java and Web services is not a panacea, but as you will see, it furnishes pragmatic solutions to real life database-related problems.

I am convinced that you will have fun playing with the code samples; the soft copies are available on the publisher’s web site http://www.elsevier.com and linked from my blog http://db360.blogspot.com, where I share thoughts on database programming, beyond this book.

Kuassi Mensah

San Francisco, California

April 2006



[1] Data Architect or Data Tier Architect is an emerging high-profile database-centric job.

[2] Oracle dropped J2EE from the database starting with Oracle 9i Release 2, in favor of a more competitive and lightweight J2EE stack in the Oracle Application Server.

[3] Plain Old Java Object, Plain Old Java Interface, Mapped Old Java Objects

[4] Grid computing within the enterprises, as opposed to academic/research grids

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.14.93