jdbc vs. java blend presentation by gopal manchikanti shivakumar balasubramanyam
TRANSCRIPT
![Page 1: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/1.jpg)
JDBC Vs. Java BlendPresentation by
Gopal Manchikanti
Shivakumar Balasubramanyam
![Page 2: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/2.jpg)
JDBC Technology
![Page 3: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/3.jpg)
INTRODUCTION
Structured Query Language(SQL)
Microsoft’s ODBC
Need for JDBC
About JDBC
![Page 4: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/4.jpg)
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
![Page 5: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/5.jpg)
ODBCMicrosoft Product
C-Based Interface to SQL-Based Databases
Provides a consistent Interface for communicating
![Page 6: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/6.jpg)
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
![Page 7: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/7.jpg)
JDBCCreates 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
![Page 8: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/8.jpg)
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
![Page 9: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/9.jpg)
JDBC Architecture
JDBC API for Application Writers
JDBC API for Driver Writers
JDBC - Two-Tier and Three-Tier Models
JDBC URL’s
![Page 10: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/10.jpg)
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
![Page 11: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/11.jpg)
JDBC API
ClientDataBase Sever
Application GUI
JDBC API
Network Interface
Network Connection
SQL RequestsSQL Results SQL Results
![Page 12: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/12.jpg)
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
![Page 13: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/13.jpg)
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
![Page 14: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/14.jpg)
Client/Server Model
Client DataBase Sever
Application GUI
JDBC Driver
Network Interface
Network Connection
SQL RequestsSQL Results SQL Results
Network Interface
![Page 15: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/15.jpg)
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
![Page 16: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/16.jpg)
Three-Tier Model
Client DataBase Sever
Application GUI
JDBC Driver(Cl)
Network InterfaceNetwork Interface
JDBC Driver(ser) Database Lib.
Network Interface Network Interface
Network ANetwork B
MIDDLE WARE
![Page 17: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/17.jpg)
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>
![Page 18: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/18.jpg)
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
![Page 19: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/19.jpg)
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
![Page 20: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/20.jpg)
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
![Page 21: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/21.jpg)
SECURITY Issues
Restriction from opening Network Connections
DataBase needs to reside on the WebServer
![Page 22: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/22.jpg)
Key Features of JDBC
Full Access to Metadata
No Installation
Database Connection Identified by URL
Connection Pooling and Distributed Transactions
![Page 23: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/23.jpg)
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
![Page 24: JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam](https://reader034.vdocuments.net/reader034/viewer/2022051416/56649e115503460f94afc68a/html5/thumbnails/24.jpg)
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)