Java Applets and Data Bases Connectivity
Simple Approach
Damir Kirasic
damir.kirasic@fer.hr
Hrvoje Zokovic
hrvoje.zokovic@fer.hr
Faculty of Electrical Engineering and Computing
Unska 3, 10000 Zagreb, Croatia
The purpose of this presentation is to show you a small,
preliminary project which demonstrate the possibility
of connecting Java applets and data bases.
In particular, a small applet which can search
Informix data base consisting of list of publications
in our library will be demonstrated.
Outline of presentation:
- Real applet in action
- Computers and programs involved
- What is inside programs?
- "Official" approach: JDBC
- The future of applets and data base connectivity
Computers involved
Three computers scenario:
Two computers scenario:
Programs involved
4 program components:
- appClient - resides on the Client machine
- appTransfer - resides on the WEB Server
- dbAgent - resides on the DB Server
- RDBMS - resides on the DB Server
Note: Instead of Java applet we can have a stand-alone
Java application on the client side.
The appTransfer program is not necessary
in that case but whith appTransfer we can satisfy both situations.
Note: appTransfer is necessary in the three computers scenario
and when we have Java applets on the client side because Java
applets can open connections only to the
WEB Server from which applet is downloaded.
In future we could use signed applets which
can open connections to the arbitrary computers
but we must wait for browsers which support them.
appClient's tasks:
- Show entry form
- Check input data
- Create SQL query
- Send query to the J-Transport
- Read the results from the J-Transport
- Show the results
appTransfer's tasks:
- Transfer SQL query from appClient to dbAgent
- Transfer the results back from dbAgent to appClient
dbAgent's tasks:
- Read the SQL query from appTransfer
- "Send" the SQL query to the RDBMS
- Read the results
- Send the results back to the appTransfer
What is inside programs:
The source code for the appClient can be found
here.
The source code for the appTransfer can be found
here.
The source code for the dbAgent can be found
here.
"Official" approach: JDBC
What is JDBC:
JDBCTM is a JavaTM API for executing SQL statements. (As a point of interest, JDBC is a trademarked name and is not an acronym; nevertheless, JDBC is often thought of as standing for "Java Database Connectivity".) It consists of a set of classes and interfaces written in the Java programming language. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure Java API.
(The definition is taken from the JDBC guide written by
the Java Team.)
Click here
for the complete JDBC guide.
The future of the applets and data base connectivity:
The future is great:
- Client side must have no specific software.
(Java enabled browsers are standard today).
- Real graphical user interface.
- Real client/server paradigm.
- No application distribution.
- Centralized application administration.