Previous | Table of Contents | Next
Page 503
- oracle.jsql.BinaryStreamAn
InputStream-derived class whose bytes should be interpreted as binary.
- oracle.jsql.BooleanInOutA holder class used to pass an argument of
type BOOLEAN as an in-out parameter to a J/SQL operation.
- oracle.jsql.byteArrayInOutA holder class used to pass an argument of
type byte[] as an in-out parameter to a J/SQL operation.
- oracle.jsql.DateInOutA holder class used to pass an argument of
type java.sql.Date as an in-out parameter to a J/SQL operation.
- oracle.jsql.DateOutA holder class used to pass an argument of
type java.sql.Date as an out parameter to a J/SQL operation.
- oracle.jsql.ExecStatusExecStatus defines the status of the last
successfully executed SQL.exec() operation on a particular instance of
JSQLntext.
- oracle.jsql.IntegerInOutA holder class used to pass an argument of
type Integer as an in-out parameter to a J/SQL operation.
- oracle.jsql.JSQLContextJSQLContext manages a set of SQL operations
performed during a session with a specific database.
JSQLContext implements the JDBC connection interface, and as such it can be used as an entry point
for performing dynamic SQL operations in the same way you would use any
other JDBC connection.
- oracle.jsql.JSQLException ()A constructor without an associated
error message.
- oracle.jsql.JSQLException
(string)A constructor with an associated
error message.
- n oracle.jsql.ObjectInOutA holder class used to pass an argument of type
Object as an in-out parameter to a J/SQL operation.
- oracle.jsql.StreamWrapperThis class wraps a particular instance of
InputStream. It also extends the InputStream class by providing direct call-throughs to
the wrapped InputStream instance for all methods.
- oracle.jsql.StringInOutA holder class used to pass an argument of type
String as an in-out parameter to a J/SQL operation.
- oracle.jsql.TimeInOutA holder class used to pass an argument of
type java.sql.Time as an in-out parameter to a J/SQL operation.
- oracle.jsql.TimestampInOutA holder class used to pass an argument of
type java.sql.Timestamp as an in-out parameter to a J/SQL operation.
- oracle.jsql.UnicodeStreamAn
InputStream-derived class whose bytes should be interpreted as Unicode. When passing
InputStream as an input parameter to a SQL.exec() operation, you must specify both the length of
InputStream and the way to interpret its bytes.
Page 504
As mentioned earlier, JDBC provides the standard interface between Java and the
database. At this point, I would like to take a brief minute and discuss JDBC.
JDBC (Java Database Connectivity) is a standard relational database access interface.
It's somewhat analogous to Microsoft's ODBC (Open Database Connectivity) in that JDBC
is driver based and database independent. JDBC is widely supported by third-party
tool vendors and many popular databases. As such, JDBC will remain the main database
access mechanism for Java for the near future.
JDBC requires an operating system driver to access the relational database. Several
company vendors provide generic JDBC-ODBC bridge drivers that allow any ODBC driver to be
used with JDBC. With these bridge drivers, the JDBC API acts as a wrapper for the
underlying ODBC calls. To use the drivers, place JDBC calls within your Java source code.
Unfortunately, being driver based is also the main disadvantage
of JDBC. JDBC requires the drivers to be installed on the same platform as the JDBC application, which means that
Java and the drivers must be installed with the Internet browser. This adds to the complexity
of the overall application architecture. This is a limitation you must endure to have the
Java-relational database connectivity. Another limitation of JDBC is that it provides access to
the standard SQL types only and does not support the Oracle-specific types such as
ROWID.
Even though JDBC has these few limitations, it does offer the following benefits:
- Oracle supports the entire JDBC standards. Some RDBMSs support only a
partial JDBC standard.
- Oracle's JDBC drivers are portable to several other environments.
- Oracle has designed a special version of JDBC that is stored inside the
Oracle database. This dramatically improves access performance.
PL/SQL and Java have many similarities and common strengths that make them
both outstanding programming languages. Likewise, they have some differences that are
attributable to their purposes and origins. PL/SQL and Java compare and contrast as follows:
- One of PL/SQL's main strengths is its ability to manipulate data. Structures such
as cursors, loops, and arrays offer an advantage over Java.
- Both Java and PL/SQL allow SQL to be embedded within them for standard
data access routines. PL/SQL allows native SQL code within it while Java source
code requires J/SQL or a similar language to incorporate SQL.
Page 505
- PL/SQL is very integrated and operates almost seamlessly with the Oracle
database. To access Oracle through Java, you need to use J/SQL or some other means.
- PL/SQL and Java both have the capability to process data locally, without
regard for execution location and networking aspects.
- Java enables you to take advantage of several object orientation (OO) features
such as classes and inheritance. PL/SQL doesn't support these two OO features.
However, both languages incorporate OO encapsulationPL/SQL through
packages and Java through classes.
- Java tends to be more "wordy" than PL/SQL. In other words, Java requires
more definitions and lacks the capability to use logical pointers.
Over the past several years, the primary user interface to the Internet and the World
Wide Web (WWW) has been the browser. Internet browsers from companies such as
Oracle, Microsoft, and Netscape primarily access Web pages, which are written in
Hypertext Markup Language (HTML) and Java.
You learned earlier in this chapter that Java and J/SQL can be integrated to give Java
access to an RDBMS. J/SQL opens the door and allows Web pages that use Java to access
Oracle databases. This RDBMS access from a Web browser is the architecture of the future. In
fact, it has already begun. Internet applications such as E-COMMERCE (Electronic
Commerce) would not be possible without this Web-page-to-database connectivity. E-COMMERCE
is the applications that allow you to perform sales and purchasing activities over the
Internet. Figure 21.2 illustrates typical scenarios for the processing of SQL statements through a
Web page or a Web server.
At this point, I want to share with you several options, other than J/SQL and JDBC,
that enable you to have Java-to-RDBMS connectivity. Although I prefer and recommend
J/SQL, it's important and reasonable for me to review alternatives with you:
- Oracle provides a Java cartridge that includes classes for calling stored
procedures directly from a Java application. This is accomplished by Oracle using
class wrappers around the PL/SQL packages, functions, and procedures.
- One vendor, WebLogic Inc., offers APIs for database access from Java. These
APIs are classes that treat Oracle tables as arrays and records to automatically
generate the necessary DML statements.
- Various vendors offer their own, nonstandard interfaces
that use JDBC, ODBC, or their own proprietary database drivers. Exercise some caution here to ensure
driver compatibility. For information about JDBC interfaces and drivers, check out
the site at
http://splash.javasoft.com/jdbc.
Previous | Table of Contents | Next
|
Используются технологии
uCoz