Database Reference
In-Depth Information
JDBC is an alternative to ODBC and ADO that provides
database access to programs written in Java. A JDBC driver is
available for almost every conceivable DBMS product. Sun de-
fines four driver types. Type 1 drivers provide a bridge between
Java and ODBC. Types 2, 3, and 4 are written entirely in Java.
Type 2 drivers rely on the DBMS product for intermachine
communication, if any. Type 3 drivers translate JDBC calls into
a DBMS-independent network protocol. Type 4 drivers trans-
late JDBC calls into a DBMS-dependent network protocol.
An applet is a compiled Java bytecode program that is
transmitted to a browser via HTTP and is invoked using the
HTTP protocol. A servlet is a Java program that is invoked on
the server to respond to HTTP requests. Type 3 and Type 4
drivers can be used for both applets and servlets. Type 2 driv-
ers can be used only in servlets, and only then if the DBMS
and Web server are on the same machine or if the DBMS
vendor handles the intermachine communication between
the Web server and the database server.
There are four steps when using JDBC: (1) load the
driver, (2) establish a connection to the database, (3) create a
statement, and (4) execute the statement.
Java Server Pages ( JSP) technology provides a means to
create dynamic Web pages using HTML (and XML) and Java.
JSP pages provide the capabilities of a full object-oriented
language to the page developer. Neither VBScript nor JavaScript
can be used in a JSP page. JSP pages are compiled into machine-
independent bytecode.
JSP pages are compiled as subclasses of the HTTPServlet
class. Consequently, small snippets of code can be placed in
a JSP page, as well as complete Java programs. To use JSP, the
Web server must implement the Java Servlet 2.1+ and JSP
1.0+ specifications. Apache Tomcat, an open-source product
from the Jakarta Project, implements these specifications.
Tomcat can work in conjunction with Apache or as a stand-
alone Web server for testing purposes.
When using Tomcat (or any other JSP processor), the
JDBC drivers and JSP pages must be located in specified di-
rectories. When a JSP page is requested, Tomcat ensures that
the most recent page is used. If an uncompiled newer version
is available, Tomcat will automatically cause it to be parsed
and compiled. Only one JSP page can be in memory at a
time, and JSP requests are executed as a thread of the servlet
processor, not as a separate process. The Java code in a JSP
page can invoke a compiled Java bean, if desired.
PHP (PHP: Hypertext Processor) is a scripting language
that can be embedded in Web pages. PHP is extremely popu-
lar and easy to learn, and it can be used in most Web server
environments and with most databases.
For creating complex pages, you need an integrated
development environment (IDE). An IDE gives you the most
robust and user-friendly means of creating and maintaining
Web pages. Microsoft Visual Studio, NetBeans for Java users,
and the open-source Eclipse IDE are all good IDEs. Eclipse
provides a framework that can be modified by add-in mod-
ules. For PHP, there is a modification of Eclipse called the
Eclipse PDT Project that is specifically intended to provide a
PHP development environment.
PHP now includes object-oriented features and PHP
Data Objects (PDO), which simplify connecting Web pages
to databases.
The confluence of database processing and document
processing is one of the most important developments in
information systems technology today. Database processing
and document processing need each other. Database pro-
cessing needs document processing for the representation
and materialization of database views. Document processing
needs database processing for the permanent storage of data.
SGML is as important to document processing as the
relational model is to database processing. XML is a series of
standards that were developed jointly by the database pro-
cessing and document processing communities. XML pro-
vides a standardized yet customizable way to describe the
contents of documents. XML documents can automatically
be generated from database data, and database data can be
automatically extracted from XML documents.
Although XML can be used to materialize Web pages,
this is one of its least important uses. More important is its
use for describing, representing, and materializing database
views. XML is on the leading edge of database processing;
see www.w3.org and www.xml.org for the latest developments.
XML is a better markup language than HTML, primarily
because XML provides a clear separation between document
structure, content, and materialization. Also, XML tags are
not ambiguous.
The content of XML documents can be described by
Document Type Declarations (DTDs) and by XML Schemas.
An XML document that conforms to its DTD is called type-
valid. A document can be well formed and not be type-valid,
either because it violates the structure of its DTD or because
it has no DTD.
XML documents are transformed when an XSLT pro-
cessor applies an XSL document to the XML document. A
common transformation is to convert the XML document
into HTML format. In the future, other transformations will
be more important. For example, XSL documents can be
written to transform the same Order document into differ-
ent formats needed by different departments, say for sales,
accounting, or production. XSLT processing is context ori-
ented; given a particular context, an action is taken when a
particular item is located. Today, most browsers have built-
in XSLT processors.
XML Schema is a standard for describing the content
of an XML document. XML Schema can be used to define
custom vocabularies. Documents that conform to an XML
Schema are called schema-valid . Unlike DTDs, XML Schema
documents are themselves XML documents and can be vali-
dated against their schema, which is maintained by the W3C.
Schemas consist of elements and attributes. There are
two types of elements: simple and complex. Simple elements
have one data value. ComplexType elements can have mul-
tiple elements nested within them. ComplexTypes may also
have attributes. The elements contained in a ComplexType
may be simple or other ComplexTypes. ComplexTypes may
also define element sequences. A good rule of thumb is that
Search WWH ::




Custom Search