Given by Konrad Olszewski at Rome Lab Quarterly Review for CIV on June 28 96. Foils prepared 23 February 97
Outside Index
Summary of Material
This talk contrasts 4 approaches to Linking Java to Databases |
JDBC -- Java Database Connection |
Oracle Web Server |
WebLogic products |
Netscape LiveWire |
Outside Index Summary of Material
Report about existing solutions |
Konrad Olszewski |
10th June 1996 |
JDBC |
Oracle Web Server |
WebLogic products |
Netscape LiveWire |
Java - interactive Web computing, portable programming language, persistent client-server networking |
RDBMS - information management, search backend, data processing |
Java + RDBMS - fully integrated client-server application on WWW |
WWW client |
HTTP server |
traditionally using CGI for HTTP server to |
access databases and query results were displayed as HTML pages on Web browsers |
the requests and responses were transmitted using HTTP protocol, no session notion and database transaction logic is not perserved. |
CGI script |
HTTP |
protocol |
WWW client |
HTTP server |
integrated |
DB client |
applet |
standalone application |
server |
Java offers the advantages:
|
direct access |
Portable Java API for connecting to RDBMS and executing SQL statements |
designed after ODBC (but with Java-specific features) |
dependent on provided database drivers |
JDBC-ODBC |
Driver |
JDBC API |
JDBC Driver API |
socket |
connection |
Server application |
JDBC access |
JDBC access |
client side |
server side |
The Driver Manager tracks database drivers |
Drivers have to register themselves |
Driver Manager maps URL to drivers |
URL jdbc:<subprotocol>:<subname> |
Example:
|
Driver Manager |
Connection |
Statement |
ResultSet |
getConnection |
executeQuery |
getXXX |
createStatement |
ResultSetMetaData - description of the ResultSet
|
DatabaseMetaData - description of database connection:
|
... |
Connection conn = DriverManager.getConnection( "jdbc:odbc:sales"); |
Statement stmt = conn.createStatement(); |
ResultSet rs = stmt.executeQuery( "SELECT Name, Sales FROM Customers"); |
while (rs.next()) { |
String name = rs.getString("Name"); |
int sales = rs.getInt("Sales"); |
... |
tightly integrated with Oracle DBMS |
executing Java code on server side |
communication with database based on PL/SQL wrappers |
designed to work with dynamically created HTML |
Session session = new Session("scott", "tiger", "HR_DB"); |
//wrapper for PL/SQL package |
Employee employee = new Employee(session); PDouble pEmployeeNumber = new PDouble ((double)12345); |
System.out.println("Employee ID: " + pEmployeeNumber + " name:" + employee.employee_name(pEmployeeNumber)); |
Web client |
URL |
Oracle |
Web Server |
HTML |
WRB is a Web Request Broker |
WWW client |
URL |
OWL |
Live HTML |
with applet |
applet |
TCP/IP |
or Remote Objects |
the first one is just a Java CGI |
the second is a full client-server application
|
in second case it's necessary to develop own network protocol (or use Remote Objects in the future) |
Set of proprietary solutions to access DB from Java |
works with Oracle, Sybase and Microsoft SQL Server |
uses two and three-tier configurations |
possibly will be integrated with JDBC |
data container objects (dataset, record, value, blob) |
data description objects (schema, column, table, SelectStmt, StoredProc) |
session objects (Profile, Database, Connection) |
administration objects |
WWW client |
T3Client |
applet |
WebLogic supports cached logins - client can disconnect and connect |
once again to the same state at application server |
HTTP |
server |
applet |
download |
proprietary |
protocol |
proprietary |
protocol |
T3Server |
provided by Netscape FastTrack server |
using JavaScript to perform database operations on the server side |
database connection and SQL queries can be embedded in Javascript code in HTML pages (Javascript can interact with Java applets in future versions of Javascript) |
application server is part of HTTP server |
currently working with Oracle, Sybase, Informix, ODBC |
Database connections and operations are performed on the server |
with use of the server-side JavaScript |
HTTP |
protocol |
database |
specific |
protocol |
Database (connections, executing SQL statements, displaying tables, transaction controls) |
Cursor (data access and manipulation) |
<server> |
database.connect("ORACLE", "naos", "name", "pass", ""); |
cursor=database.cursor("select * from Employee"); |
while (cursor.next()) { |
write(cursor.id); |
write(cursor.name); |
} |
</server> |
JDBC http://splash.javasoft.com/jdbc/ |
WebLogic http://www.weblogic.com/ |
OWS http://www.oracle.com/webserver/ |
LiveWire http://wasat.npac.syr.edu/Lwdoc/livewire.htm |
The JDBC will probably establish general-purpose standard in Java/DB connectivity |
OWS is a good solution for applications tightly related to Oracle and based on PL/SQL |
LiveWire is suitable for easy access to DB from HTML pages |