Oracle9i SQLJ Programming

Oracle9i SQLJ Programming

2.3 3
by Nirva Morisseau-Leroy, Gerald P. Momplaisir, Martin K. Solomon
     
 

View All Available Formats & Editions

From the official Oracle Press comes a comprehensive guide to developing enterprise-level database applications with static and dynamic embedded SQL for Java—SQLJ. You'll learn to develop hosted applications, achieve remarkable scalability, implement real-time business intelligence features, and reach a new level of programming functionality. The CD-ROM contains… See more details below

Overview

From the official Oracle Press comes a comprehensive guide to developing enterprise-level database applications with static and dynamic embedded SQL for Java—SQLJ. You'll learn to develop hosted applications, achieve remarkable scalability, implement real-time business intelligence features, and reach a new level of programming functionality. The CD-ROM contains ready-to-run Java scripts, applications, and an electronic SQLJ Quick Reference Appendix.

Product Details

ISBN-13:
9780072190939
Publisher:
McGraw-Hill Companies, The
Publication date:
07/01/2001
Series:
Oracle Press Series
Pages:
687
Product dimensions:
7.42(w) x 9.12(h) x 1.72(d)

Related Subjects

Read an Excerpt

Chapter 1: Introduction to Oracle9i SQLJ

SQLJ is a version of embedded SQL that is tightly integrated with the Java programming language, in which embedded SQL is used to invoke SQL statements within "host" general-purpose programming languages such as C, C++, Java, Ada, and COBOL. In an embedded SQL program, SQL statements appear as if they are directly supported as host program constructs. C and C++ can also invoke SQL statements through host language function calls via the open database connectivity (ODBC) interface. Similarly, Java programs can invoke SQL statements through the Java database connectivity (JDBC) method calls. However, as you shall see, such function call interfaces reside at a much lower level than the embedded SQL interfaces. The SQL statements in the traditional embedded SQL are passed as string arguments to functions instead of being directly coded within the host program.

The Oracle relational database management system (Oracle RDBMS) is an object-relational database that heavily emphasizes the Java programming language and the development of Internet/intranet database applications. One of the important features of Oracle8i and 9i is the full and efficient support of SQLJ. Starting with Oracle8i release 8.1 .5 (April, 1999) and following up with Oracle8i release 8.1.6 (December, 1999), Oracle8i release 8.1.7 (July, 2000), and the upcoming release Oracle9i (early 2001), Oracle furnishes Java programmers with an end-to-end Java solution for creating, deploying, and managing Java applications.

The Oracle solution consists of client-side and server-side programming interfaces and a Java virtual machine integrated with the Oracle8i and 9i database servers. More importantly, Oracle provides several tools for building Java-based components that can reside anywhere on a network (client-side components) and others (server-side components) that can reside inside application or database servers. All of these products are 100 percent compatible with Java standards. As with Oracle8, Oracle8i and 9i not only provide powerful support for relational database processing, but also support such object-relational structures as collection types, user-defined types, and object types. In Chapter 8, you will learn about object-relational processing using SQLJ.

SQLJ consists of a set of syntax and programmatic extensions that define the interaction between SQL and Java. The term SQLJ refers to a series of specifications for ways to embed SQL in the Java programming language. In 1999, SQLJ was defined as static embedded SQL for the Java programming language; in other words, a SQLJ program is a Java program containing static embedded SQL statements. Notice that in static embedded SQL, all the SQL statements embedded in the program are known at compile time, while in dynamic (embedded) SQL at least some SQL statements are not completely known until run time.

Prior to Oracle9i release, SQLJ complemented the JDBC dynamic embedded SQL model with a static embedded SQL model. JDBC provided (and does up to today) a dynamic SQL interface for Java, whereas SQLJ provided a static embedded SQL interface. Thus, with the availability of SQLJ, Java programmers had two different programming interfaces between Java and SQL: JDBC and SQLJ. With the upcoming release of Oracle9i, Oracle SQLJ will provide static and dynamic embedded SQL access for Java. Consequently, application developers can use one single interface between Java and SQL: SQLJ.

Programming languages such as C, C++, FORTRAN, COBOL, and Ada share essentially the same embedded SQL, whereas SQLJ has been specified for Java as a somewhat different embedded SQL standard by the ANSI (part 10 of the ANSI Standard: X3.135.10-1998) standards organization and also by ISO: (ISO/IEC 9075-10:2000). This raises the question of why Java has its own embedded SQL, while all the other programming languages share essentially the same embedded SQL. One reason is that SQLJ is more tightly coupled to Java than in other programming languages. In particular, Java classes can be used as the types for the columns in SQL tables. Also, SQLJ provides a strongly typed version of the cursor construct, called an iterator. This iterator construct is nicely integrated into the Java language, where an iterator is represented by a Java class. Note also that, like embedded SQL for the other programming languages, Oracle9i SQLJ permits both static and dynamic SQL constructs.

In this chapter, which provides an overview of SQLJ in the Oracle8i and Oracle9i environments, you will learn the following:

  • The relation of the Java language to database processing on the Internet.

  • The tight integration of Java and the Oracle8i and Oracle9i database servers (Oracle Java VM, formerly called Oracle JServer). Note that throughout the book, Oracle Java VM and Oracle JServer JVM will be used interchangeably, and both terms will refer to the JVM embedded in the Oracle database server.

  • The static and dynamic embedded SQL model for Java: SQLJ. Note that the static embedded SQL model applies to Oracle8i releases 8.1.5, 8.1.6, and 8.1.7 Also note that 8.1.5, 8.1.6, and 8.1.7 are called Oracle 8i release 1, Oracle 8i release 2, and Oracle 8i release 3, respectively, whereas the embedded SQL model that applies to Oracle9i includes both static and dynamic embodiment of SQL in the Java programming language.

  • The deployment of SQLJ in thick and thin client-side and server-side applications.

  • How SQLJ compares to other embedded SQL languages such as Pro*C and PL/SQL.

Relation of the Java Language to Database Processing on the Internet

Java is a modern object-oriented programming language that borrows heavily from the syntax and semantics of the C and C++ programming languages. Its initial popularity came from its capability for developing client-based applications and adding dynamic content to Web pages. Over the last several years, however, Java has matured from a programming language used to develop client-based programs, in particular Graphical User Interface (GUI) programs, to a platform for developing and deploying applications at all levels of an organization by distributing applications over networks using Internet/intranet capabilities (that is, enterprise applications).

Java facilitates the development of robust and portable programs. As with most modern programming languages, Java is object oriented from the ground up. This contributes to the robustness of applications developed in the language. Additionally, Java provides mechanisms that help developers produce robust code, including early (compile-time) checking, later dynamic (run-time) checking, and a pointer model that eliminates the possibility of overwriting memory and corrupting data. Some of Java's other features that contribute to robustness are automatic storage management (referred to as garbage collection) and type safety. Such features make Java ideal for serverside programming, in which a server crash can be quite costly in terms of time and money. Java defines both a language and a set of standard class libraries (Java packages) that ensure that applications can be constructed to run on any Java Virtual Machine (JVM). The JVM is an interpreter for Java; therefore, a program can be ported from one machine architecture to another with minimal change. The JVM is responsible for controlling the Java execution environment and obtaining resources from the computer hardware. Java programs are compiled into compact intermediate hardware-independent code (Java's bytecode). Also, the fact that Java is interpreted makes it easier for the system to perform run-time error checking, further enhancing the robustness of Java programs.

Traditional design and development strategies create monolithic systems. A monolithic system corresponds to a single application, running or executing on a single computer. Business and scientific applications are becoming far more complex than they have ever been. Therefore, their designers are turning to techniques such as distributed systems in response to the increased pressure to better manage and manipulate information. Java provides a platform and framework for developing and deploying applications for today's complex information systems. The Java language, with its component-based models, enables users to assemble, partition, and distribute application components across a network. Java's components consist of a set of platform-independent services, such as Remote Method Invocation (RMI), JavaBeans, and Enterprise JavaBeans (EJB). RMI is a standard Java facility that makes it possible to...

Read More

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >