Download JDBC

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Oracle Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Btrieve wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

ContactPoint wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

SQL wikipedia , lookup

Database model wikipedia , lookup

PL/SQL wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Transcript
JDBC Vs. Java Blend
Presentation by
Gopal Manchikanti
Shivakumar Balasubramanyam
JDBC Technology
INTRODUCTION
Structured Query Language(SQL)
Microsoft’s ODBC
Need for JDBC
About JDBC
SQL
Used to Create,Manipulate,Examine and Manage Databases
Application Specific Language
Unsuitable as a General Application Language
Another Language Needed for Visual Display and Report Generation
ODBC
Microsoft Product
C-Based Interface to SQL-Based Databases
Provides a consistent Interface for communicating
WHY JDBC?
ODBC not appropriate for direct use from Java
Translation of ODBC API into Java API - Not Desirable
ODBC is hard to Learn
JDBC is needed to enable a “pure Java” solution
JDBC
Creates a Interface for communicating with Databases
Based on the X/Open SQL Call Level Interface
Allows Reuse of Database Connections - Connection Pooling
Useful in Accessing data across incompatible DBMS
JDBC
Easy to Learn and Use
Provides a truly portable solution to writing Database Applications
Talk to a variety of Databases
Maintain the Security, Robustness and Portability
JDBC Architecture
JDBC API for Application Writers
JDBC API for Driver Writers
JDBC - Two-Tier and Three-Tier Models
JDBC URL’s
The JDBC API
Establish a Connection with a Database
java.sql.Environment - allows creation of new database connections
Send SQL statements
java.sql.Statement - container class for embedded SQL statements
Process the results
java.sql.ResultSet - access control to results of a statement
JDBC API
Client
Application GUI
DataBase Sever
JDBC API
Network Interface
SQL Results
SQL Requests
Network Connection
SQL Results
JDBC Drivers
JDBC requires drivers to connect with individual Databases
Types of Drivers:
1.JDBC-ODBC bridge
2.Partial Java Driver
3.Pure Java driver for database middle ware
4.Direct-to-database pure Java driver
Two-tier and Three-tier Models
JDBC supports both two-tier and three-tier models for database access
Two-tier Model :
Applet/Application talks directly to the database
Requires a JDBC driver that can communicate with the database
Referred to as Client/Server Configuration
Client/Server Model
DataBase Sever
Client
Application GUI
JDBC Driver
Network Interface
Network Interface
SQL Results
SQL Requests
Network Connection
SQL Results
Two-tier and Three-tier Models
Three-tier Model :
Commands and Results sent to “middle tier” of services
Attractive as it maintains control on the accesses and updates
User can use a easy-to-use higher-level API
Middle-tier implemented in Java gives advantages of
Robustness, Multithreading and Security features
Three-Tier Model
Client
DataBase Sever
Application GUI
JDBC Driver(Cl)
Network Interface
Network Interface
Network A
Network B
MIDDLE
WARE
Network Interface
Network Interface
JDBC Driver(ser)
Database Lib.
JDBC URL’s
Way of Identifying a database
Appropriate Driver recognizes it and establishes a connection
Allow driver writers to encode all necessary connection information
Allow a level of indirection
Standard syntax: jdbc:<subprotocol>:<subname>
Driver Manager
DriverManager class maintains a list of Driver classes
Driver classes need to register with the Driver Manager
Registration is done automatically by the driver when it loaded
Allows Keeping Track of Available Drivers
Connecting-Talking-Processing
A Connection Object represents a connection with a database
A Connection Session includes Statements executed and Results got
DriverManager.getConnection() - Standard way to establish connection
The method takes a string containing a URL
DriverManager tries to use each of the drivers in the order of registration
Connecting-Talking-Processing
DriverManager tests the drivers by calling the Driver.connect
The first driver that recognizes the URL makes the connection
Mechanism for reading and writing data between Java and SQL
JDBC define a set of generic SQL type identifiers
Dynamic Data Access
SECURITY Issues
Restriction from opening Network Connections
DataBase needs to reside on the WebServer
Key Features of JDBC
Full Access to Metadata
No Installation
Database Connection Identified by URL
Connection Pooling and Distributed Transactions
Advantages of JDBC
Leverage Existing Enterprise Data
Simplified Enterprise Development
Zero Configuration for Network Computers
For e-commerce applications running on the Internet
Gives all advantages of Java like Portability, Security and Robustness
FURTHER Advancements
JDBC is a base for Higher-Level APIs
Higher-Level APIs on top of JDBC :
An embedded SQL for Java - allows mixing SQL statements within Java
Direct Mapping of Relational Database tables to Java classes.(Java Blend