Network Interface

advertisement
SQL (Structured Query Language)
X/OPEN Call Level Interface For SQL
ODBC (Open DataBase Connectivity) API
JDBC (Java DataBase Connectivity) API
SQL (Structured Query Language)
SQL89, SQL92, SQL3
X/OPEN Call Level Interface
ODBC API
JDBC-ODBC
Bridge
JDBC API
Client
Application GUI
Database Server
JDBC API
Network Interface
SQL Results
SQL Requests
SQL Results
SQL Requests
Network Connection
JDBC API defines a set of interfaces and classes to be used
for communicating with a database.
Client
Application
Database Server
JDBC Driver
Database Libraries
Network Interface
SQL Results
SQL Requests
SQL Results
SQL Requests
Network Connection
JDBC Driver: translates java into SQL.
JDBC drivers are implemented by database vendors.
JDBC supports the ANSI SQL92 Entry Level standard.
JDBC supports:
•ANSI SQL92 Entry Level Standard
•Improvements of SQL89
•meta-data
•DDL statements
•Vendor independent syntax for using
•stored procedures
•scalar functions
•outer joins
Note:
Since no syntax checking is performed by JDBC,
it is possible to execute any SQL statements at the expense of
portability.
Trusted Applications:
Any stand-alone applications that are stored in local drives and
have access to local resources.
Downloaded applets are untrusted applications.
They cannot write to local files, open arbitrary network connections,
or even read environment variables.
One way to make applets trusted is by code signing.
JDBC applets are restricted from opening network connections to
any host other than the one in which they are downloaded.
Guideline for security:
•Never allow untrusted applets direct access to your database.
•User should be required to provide credentials for every connection
made.
•User credentials should not come from a local source such as a
current login ID.
•All drivers should be tested and approved as JDBC COMPLIANT.
Components of JDBC:
•The java.sql package
•The test suite
•The JDBC-ODBC bridge
What you need to develop programs in JDBC API?
1. A SQL92 compliant database.
2. A JDBC driver for your database.
3. The java Development Toolkit version 1.1 (JDK 1.1)
JDBC Driver Types:
Driver Type
Description
1. ODBC-JDBC Bridge
Map JDBC calls to ODBC
driver calls on the client.
2. Native API-Part Java
Maps JDBC calls to native
calls on the client.
3. JDBC Network-All Java
Maps JDBC calls to network
protocol, which calls native
methods on server.
Directly calls RDBMS from
the client machine.
4. Native Protocol-All Java
Type I: JDBC-ODBC Bridge Driver
Client
Application
JDBC Driver
Local Disk
ODBC Driver
Network Interface
SQL Requests
SQL Results
Proprietary Database Protocol
Network Interface
Stand-Alone Applications run on Local Machine
JDBC Driver: translates java calls into ODBC calls.
Harder to debug, slower, not work for applets.
Inexpensive, readily available.
Database
Server
Type II: Native-API-Partly Java Driver
Client
Application
JDBC Driver
Local Disk
Native Database Libraries
(Call Level Interface)
Network Interface
SQL Requests
SQL Results
Proprietary Database Protocol
Network Interface
JDBC Driver: use local libraries to communicate
with database server. Java calls are translated into
local CLI calls.
Faster than the ODBC bridge, not work for applets.
Database
Server
Type III: JDBC-Net-All-Java Driver
Client
Application
JDBC Driver
(Client)
Local Disk
Network Interface
SQL Requests
SQL Results
JDBC Driver Network Protocol
Network Interface
•JDBC Driver: client calls are translated into
driver-specific network protocol.
•JDBC Driver: server listenser translates the
requests into CLI calls at server site.
•All database-specific code resides on the
server.
•JDBC driver network protocol is not
Server
JDBC Driver
(Server Listenser)
Database
Native Database Libraries
(Call Level Interface)
Type III: JDBC-Net-All-Java Driver
•JDBC driver network protocol is not standardized.
•It implies that compatible client and server drivers
from a specific vendor must be used.
•It can be used over internet.
Type IV: Native-Protocol-All-Java Driver
Client
Application
Local Disk
JDBC Driver
Network Interface
SQL Requests
SQL Results
Proprietary DB Protocol (in Java)
Network Interface
•JDBC Driver: 100% java and use no CLI
native libraries.
•Support applets containing the driver to be
downloaded over the network, I.e., applets can
communicate directly with the database.
Server
Database
Download