JDBC SHORT NOTES. Abstract This document contains short notes on JDBC, their types with diagrams. Rohit Deshbhratar [ address]

Similar documents
Introduction JDBC 4.1. Bok, Jong Soon

JDBC. Sun Microsystems has included JDBC API as a part of J2SDK to develop Java applications that can communicate with databases.

Unit 3 - Java Data Base Connectivity

Enterprise Java Unit 1- Chapter 6 Prof. Sujata Rizal

MANTHLY TEST SEPTEMBER 2017 QUESTION BANK CLASS: XII SUBJECT: INFORMATICS PRACTICES (065)

(C) Global Journal of Engineering Science and Research Management

Client/Server-Architecture

UNIT-3 Java Database Client/Server

Kyle Brown Knowledge Systems Corporation by Kyle Brown and Knowledge Systems Corporation

CSE 308. Database Issues. Goals. Separate the application code from the database

Top 50 JDBC Interview Questions and Answers

Database connectivity (I) ()

e-pg Pathshala Subject: Computer Science Paper: Web Technology Module: JDBC INTRODUCTION Module No: CS/WT/26 Quadrant 2 e-text

About Database Adapters

JDBC Today C HAPTER 1 INTRODUCTION

Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science

Questions and Answers. A. A DataSource is the basic service for managing a set of JDBC drivers.

Overview. Database Application Development. SQL in Application Code. SQL in Application Code (cont.)

Database Application Development

Database Application Development

JDBC [Java DataBase Connectivity]

JDBC. Oracle ODBC SP API SP API. SQL server C function calls. SQL server ODBC SP API. Oracle DSN Oracle ODBC Oracle

You write standard JDBC API application and plug in the appropriate JDBC driver for the database the you want to use. Java applet, app or servlets

JDBC 2.0 (Java Database Connectivity)

Acknowledgments About the Authors

System i5: Maximizing Performance and Availability

QuickSpecs. ISG Navigator for Universal Data Access M ODELS OVERVIEW. Retired. ISG Navigator for Universal Data Access

COMMUNICATION PROTOCOLS

Distributed Multitiered Application

PERSİSTENCE OBJECT RELATİON MAPPİNG

1. PhP Project. Create a new PhP Project as shown below and click next

The Design of JDBC The Structured Query Language Basic JDBC Programming Concepts Query Execution Scrollable and Updatable Result Sets

Chapter 3 DB-Gateways

Chapter 3 DB-Gateways

ITP 140 Mobile Technologies. Databases Client/Server

Database Server. 2. Allow client request to the database server (using SQL requests) over the network.

SQL in a Server Environment

JDBC MOCK TEST JDBC MOCK TEST IV

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 14 Database Connectivity and Web Technologies

DQpowersuite. Superior Architecture. A Complete Data Integration Package

3-Tier Architecture For Enterprise wide IT Solutions

It Is a Difficult Question! The Goal of This Study. Specification. The Goal of This Study. History. Existing Benchmarks

JDBC Drivers Type. JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server.

Table of Contents. Introduction... xxi

Performance Evaluation of Java And C++ Distributed Applications In A CORBA Environment

Introduction to MySQL. Database Systems

Database Application Development

Introduction to SQL & Database Application Development Using Java

SD Module-1 Advanced JAVA

JDBC Architecture. JDBC API: This provides the application-to- JDBC Manager connection.

Overview. ❶ Short introduction to the company. ❶ Short history of database and DBMS. ❶ What is the next DBMS s generation? ❶ Introduction to Tamino

13. Databases on the Web

Chapter 3 DB-Gateways

Cyrus Shahabi Computer Science Department University of Southern California C. Shahabi

Application Programming for Relational Databases

1Z Java SE 5 and 6, Certified Associate Exam Summary Syllabus Questions

Lecture 2. Introduction to JDBC

JAVA AND DATABASES. Summer 2018

Fast Track to Java EE

QM Chapter 1 Database Fundamentals Version 10 th Ed. Prepared by Dr Kamel Rouibah / Dept QM & IS

Chapter 2 FEATURES AND FACILITIES. SYS-ED/ Computer Education Techniques, Inc.

How to Configure Informix Connect and ODBC

Oracle Database Jdbc Developer's Guide And Reference 10g Release 2

Java and the Java DataBase Connectivity (JDBC) API. Todd Kaufman April 25, 2002

DBMS (FYCS) Unit - 1. A database management system stores data in such a way that it becomes easier to retrieve, manipulate, and produce information.

Java Database Connectivity

CMPT 354 Database Systems I

Designing a Distributed System

TRIMS Web. Next Generation TRIMS TD T. Go.

Adding Mobile Capability to an Enterprise Application With Oracle Database Lite. An Oracle White Paper June 2007

Java Enterprise Edition

Distributed Systems Architectures. Ian Sommerville 2006 Software Engineering, 8th edition. Chapter 12 Slide 1

SQL: Programming Midterm in class next Thursday (October 5)

ArcSDE 8.1 Questions and Answers

<Insert Picture Here> MySQL Cluster What are we working on

Leveraging Legacy Systems in a Network Computing Architecture

UNIT III - JDBC Two Marks

What is database? Types and Examples

Part I: Stored Procedures. Introduction to SQL Programming Techniques. CSC 375, Fall 2017

CAS 703 Software Design

UNIT-VIII Introduction of Java Database Connectivity

Database Server. Database Database Database

Multimedia Database Architecture!

Middleware and Web Services Lecture 2: Introduction to Architectures

Chapter 13. Application Architecture and Modeling. McGraw-Hill/Irwin. Copyright 2007 by The McGraw-Hill Companies, Inc. All rights reserved.

PESIT Bangalore South Campus

JavaEE Interview Prep

DataBase Lab JAVA-DATABASE CONNECTION. Eng. Haneen El-masry

Active Server Pages Architecture

COMP102: Introduction to Databases, 23

SQL DML and DB Applications, JDBC

What every DBA needs to know about JDBC connection pools Bridging the language barrier between DBA and Middleware Administrators

Borland AppServer. Borland

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Crystal Reports. Overview. Contents. Open Database Connectivity (ODBC)

Introduction To Web Architecture

Application management in Nokia: Getting the most from Company Apps

JDBC BASIC 19/05/2012. Objectives. Java Database Connectivity. Definitions of JDBC. Part 1. JDBC basic Working with JDBC Adv anced JDBC programming

SQL: Programming. Announcements (September 25) Motivation. CPS 116 Introduction to Database Systems. Pros and cons of SQL.

Chapter 10 Web-based Information Systems

Transcription:

JDBC SHORT NOTES Abstract This document contains short notes on JDBC, their types with diagrams. Rohit Deshbhratar [Email address]

JDBC Introduction: Java DataBase Connectivity, commonly known as JDBC, is an API for Java programming language that defines how a client may access a database. JDBC API uses JDBC driver written in Java. JDBC is platform independent. What is API (Application Programming Interface)? API is a document that contains description of all features of a product or software. It represents classes and interfaces that software programs can follow to communicate with each other. JDBC Components JDBC includes four components 1. The JDBC API The JDBC API provides programmatic access to relational data from the Java programming language. Using the JDBC API, applications can execute SQL statements, retrieve results, and propagate changes back to an underlying data source. The JDBC API can also interact with multiple data sources in a distributed, heterogeneous environment. 2. JDBC Driver Manager The JDBC DriverManager class defines objects which can connect Java applications to a JDBC driver. DriverManager has traditionally been the backbone of the JDBC architecture. It is quite small and simple. 3. JDBC Test Suite The JDBC driver test suite helps you to determine that JDBC drivers will run your program. These tests are not comprehensive or exhaustive, but they do exercise many of the important features in the JDBC API. 4. JDBC-ODBC Bridge The Java Software Bridge provides JDBC access via ODBC drivers. Note that you need to load ODBC binary code onto each client machine that uses this driver. As a result, the ODBC driver is most appropriate on a corporate network where client installations are not a major problem, or for application server code written in Java in a three-tier architecture. 1 P a g e

JDBC Architecture The JDBC API supports both two-tier and three-tier processing models for database access. Two tier architecture In the two-tier model, a Java applet or application talks directly to the data source. This requires a JDBC driver that can communicate with the particular data source being accessed. A user's commands are delivered to the database or other data source, and the results of those statements are sent back to the user. The data source may be located on another machine to which the user is connected via a network. This is referred to as a client/server configuration, with the user's machine as the client, and the machine housing the data source as the server. The network can be an intranet, which, for example, connects employees within a corporation, or it can be the Internet. Three tier architecture In the three-tier model, commands are sent to a "middle tier" of services, which then sends the commands to the data source. The data source processes the commands and sends the results back to the middle tier, which then sends them to the user. MIS directors find the three-tier model very attractive because the middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. Another advantage is that it simplifies the deployment of applications. Finally, in many cases, the three-tier architecture can provide 2 P a g e

performance advantages. With enterprises increasingly using the Java programming language for writing server code, the JDBC API is being used more and more in the middle tier of a three-tier architecture. Some of the features that make JDBC a server technology are its support for connection pooling, distributed transactions, and disconnected rowsets. The JDBC API is also what allows access to a data source from a Java middle tier. 3 P a g e

JDBC Driver A JDBC driver is a software component enabling a java application to interact with a database. JDBC requires drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between client and database. JDBC drivers are client side adaptors that convert request from java program to a protocol that that the DBMS can understand. There are four types of driver 1. JDBC-ODBC Bridge Driver (Type 1) 2. Native API Driver (Type 2/Partially Java Driver) 3. Network Protocol Driver (Type 3/Fully Java Driver) 4. Thin Driver (Type 4/Fully Java Driver) 1. JDBC-ODBC Bridge Driver (Type 1) Uses ODBC bridge driver to connect to database. Converts JDBC methods call into function call. ODBC drivers need to be installed on client machine. This driver is platform dependent. Advantages Easy to connect Directly connected to database Disadvantage Does not support the complete java command set and are limited by the functionality of the ODBC driver. Needs to be installed on client machine. Slow, as compared to other drivers. 4 P a g e

2. Native API Driver (Type 2/Partially Java Driver) It uses client side libraries of the database. The driver converts the JDBC method call into native call. Native drivers must be installed on client machines. Vendor client libraries need to be installed on client machine. It is not written entirely in java. Advantage Better performance as compared to Type 1 driver. Disadvantage Driver is platform dependent. The vendor client library needs to be installed. Native driver needs to be installed on each machine. 3. Network Protocol Driver (Type 3/Fully Java Driver) Uses middleware that convert JDBC call directly or indirectly into vendor specific database protocol. Fully written in Java. Database specific coding to be done in middle tier. 5 P a g e

Advantage No client side library is required. Disadvantage Network support is required on client machine. Database specific coding is done in middleware. 4. Thin Driver (Type 4/Fully Java Driver) Converts JDBC calls directly into vendor specific database protocol. Fully written in Java. User needs different drivers for each database. Performance is good. 6 P a g e

Advantage Performance is good as compared to other drivers. No software is required for client or server side. Disadvantage Different types of drivers required for different database. Steps to connect to database 1. Register the driver class. 2. Create connection. 3. Create Statement. 4. Execute queries. 5. Close the connection. Package for JDBC connection 1. java.sql.*; Provides the API for accessing and processing data stored in a data source using Java. 2. javax.sql.*; Provides API for server side data source access and processing from java. 7 P a g e