Trail: Overview
|
Lesson: Overview
|
|
Networking and Connectivity
Various Java APIs let you safely interact with resources on the
Internet, on the network, and in databases.
Introduced in JDK 1.1, JDBC makes it possible to send SQL statements to
a database and to process the results that are returned. JDBC provides
uniform access to a wide range of relational databases and provides a
common base on which database tools can be built.
The JDBC implementation includes a driver manager to support multiple
drivers that mediate the connections between JDBC and various
databases. A driver can be written either entirely in the Java
programming language so it can be downloaded as part of an applet or in
a mixture of the Java programming language and native methods if it
needs to bridge to existing database access libraries.
In JDK 1.2 the java.sql
package builds on the existing SQL functionality to include
- Result sets that scroll forward and backward
- Batch updates so an application can submit multiple update
statements (insert/update/delete) in one request
- Additional support for persistent storage of objects in the Java
programming language
- SQL3 data types, such as binary large object (BLOB) and character
large object (CLOB)
- Structured types
- User-defined types (UDTs)
- Character stream support so character data can be retrieved and
sent to the database as a stream of internationalized Unicode
characters
- New methods to allow
java.math.BigDecimal
values to be returned with full precision
Remote method invocation (RMI) first appeared in JDK 1.1 and lets Java
applications use remote method calls (rather than sockets and streams)
to communicate across a network. The communicating applications can be
running on different computers on opposite sides of the planet. This
higher-level, method-based approach to network communications allows
access to a remote object as easily as to a local object.
JDK 1.2 RMI enhancements include remote object activation, downloadable
socket factories, and other minor enhancements, including
- Remote object activation introduces support for persistent
references to remote objects and automatic object activation
by way of these references.
- Downloadable socket factories allow a remote object to specify the
custom socket factory that RMI will use for remote calls to that
object. RMI over a secure transport, such as SSL, can be supported by
using downloadable socket factories.
- Other minor enhancements allow unexporting a remote object,
obtaining the stub for an object implementation, and exporting an
object on a specific port.
Java IDL adds CORBA (Common Object Request Broker Architecture)
capability to the Java platform to provide standards-based
interoperability and connectivity. Java IDL is new with JDK 1.2, so
distributed Web-enabled Java applications can transparently invoke
operations on remote network services, using the industry-standard
Object Management Group (OMG) interface definition language (IDL) and
Internet Inter-ORB Protocol (IIOP) defined by the OMG. Runtime
components include a fully compliant Java ORB for distributed computing
using IIOP communication.
The two main Java IDL packages are org.omg.CORBA
and org.omg.CosNaming.
The org.omg.CORBA
package supplies the mapping of OMG CORBA 1.0 to the Java programming
language. An implementation of the ORB class is included so a
programmer can use it as a fully functional object request broker
(ORB). An ORB object handles, or brokers, method invocations between a
client and the method implementation on the server. Because the client
and the server can be anywhere on a network and the invocation and
implementation can be in different languages, an ORB object does a lot
of behind-the-scenes work to enable the communication.
The org.omg.CosNaming
package specifies the naming service for Java IDL. The package and all
of its classes and interfaces were generated by running the
idltojava compiler on the file nameservice.idl,
which is a module written in OMG IDL.
Servlets let you extend server functionality. Servlets can be
implemented to extend a Web server's functionality in the same way that
Common Gateway Interface (CGI) scripts do. For example, a servlet can
process data entered into a form on an HTML page and can store it in a
database. Unlike CGI scripts, however, servlets use fewer resources,
are faster, and because they are coded entirely in the Java programming
language, work seamlessly across multiple hardware, software, and
server platforms.
The Java servlets API is a standard extension included in the Servlet
Development Kit; it is not part of the JDK.
JDK releases continue to enhance the security features inherent in the
Java programming language and built into the Java platform. JDK 1.0.2
restricts applets to a secure environment, or sandbox, so they cannot
access local system resources outside their sandbox. JDK 1.1 provides
digitally signed Java ARchive (JAR) files to sign and to verify the
signature on applet and application files.
JDK 1.2 introduces a strong security model and accompanying tools so
end users and system administrators can extend the security policy to
applications and can determine how much access to system resources an
applet or a Java application can have. The JDK 1.2 security policy is
easy to configure, provides fine-grain access control, and applies to
all Java applets and applications. The JDK 1.2 security tools are
JavaKey, for creating a database of keys; JAR Signer, for
signing JAR files; and Policy Tool, for granting access to system
resources.
|