Java and Database JDBC

Similar documents
What is ODBC? Database Connectivity ODBC, JDBC and SQLJ. ODBC Architecture. More on ODBC. JDBC vs ODBC. What is JDBC?

CS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University

CS/CE 2336 Computer Science II

SequeLink Server for ODBC Socket

FileMaker 14. ODBC and JDBC Guide

A Generic Database Web Service

FileMaker 11. ODBC and JDBC Guide

JDBC. It is connected by the Native Module of dependent form of h/w like.dll or.so. ex) OCI driver for local connection to Oracle

Client/server is a network architecture that divides functions into client and server

How to Configure Informix Connect and ODBC

Performance Tuning for the JDBC TM API

Java DB Performance. Olav Sandstå Sun Microsystems, Trondheim, Norway Submission ID: 860

JDBC (Java / SQL Programming) CS 377: Database Systems

SQL and Java. Database Systems Lecture 19 Natasha Alechina

Applications of JAVA programming language to database management

FileMaker 8. Installing FileMaker 8 ODBC and JDBC Client Drivers

2. Accessing Databases via the Web

DEVELOPING MULTITHREADED DATABASE APPLICATION USING JAVA TOOLS AND ORACLE DATABASE MANAGEMENT SYSTEM IN INTRANET ENVIRONMENT

Elements of Advanced Java Programming

Chapter 9 Java and SQL. Wang Yang wyang@njnet.edu.cn

Supplement IV.D: Tutorial for MS Access. For Introduction to Java Programming By Y. Daniel Liang

Version Overview. Business value

The JAVA Way: JDBC and SQLJ

PROGRESS DATADIRECT QA AND PERFORMANCE TESTING EXTENSIVE TESTING ENSURES DATA CONNECTIVITY THAT WORKS

-8*6-DYD6HPLQDU 6HUYOHW$UFKLWHFWXUHV 5DLQHU+LVV$QGUHDV.DSS 6<6725$*

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language:

Java and Databases. COMP514 Distributed Information Systems. Java Database Connectivity. Standards and utilities. Java and Databases

Chapter 1 JDBC: Databases The Java Way! What Is The JDBC? The JDBC Structure ODBC s Part In The JDBC Summary

FileMaker 12. ODBC and JDBC Guide

Database System Architecture & System Catalog Instructor: Mourad Benchikh Text Books: Elmasri & Navathe Chap. 17 Silberschatz & Korth Chap.

Applets, RMI, JDBC Exam Review

Using Oracle Real Application Clusters (RAC)

3-Tier Architecture. 3-Tier Architecture. Prepared By. Channu Kambalyal. Page 1 of 19

Configuring Apache Derby for Performance and Durability Olav Sandstå

MAKING ORACLE AND SQLJ WORK FOR YOU John Jay King, King Training Resources

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

Client-Server Applications

AD207: Advances in Data Integration with Lotus Enterprise Integrator for Domino 6.5. Sarah Boucher, Manager Enterprise Integration Development

Failover Support. DataDirect Connect for ODBC Drivers. Introduction. Connection Failover

Database Access via Programming Languages

Open Source DBMS CUBRID 2008 & Community Activities. Byung Joo Chung bjchung@cubrid.com

YOUR APP. OUR CLOUD.

Latte Rapid Application Development. William Dunlap Product Manager Borland International

Exploiting Java Technology with the SAS Software Barbara Walters, SAS Institute Inc., Cary, NC

Enterprise Java. Where, How, When (and When Not) to Apply Java in Client/Server Business Environments. Jeffrey Savit Sean Wilcox Bhuvana Jayaraman

FileMaker 13. ODBC and JDBC Guide

COSC344 Database Theory and Applications. Java and SQL. Lecture 12

UltraQuest Cloud Server. White Paper Version 1.0

SOLUTION BRIEF. Advanced ODBC and JDBC Access to Salesforce Data.

Advantage Database Server or Microsoft SQL Server which one is right for you?

Why developers should use ODBC instead of native proprietary database interfaces

B. WEB APPLICATION ARCHITECTURE MODELS

WHITE PAPER. Domo Advanced Architecture

Querying Databases Using the DB Query and JDBC Query Nodes

Database FAQs - SQL Server

Design Approaches of Web Application with Efficient Performance in JAVA

What Is the Java TM 2 Platform, Enterprise Edition?

JDBC Drivers, Bridges and SequeLink. Edward M. Peters Vice President & General Manager DataDirect

Database Programming. Week *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford

Self-test Database application programming with JDBC

How To Use A Sas Server On A Java Computer Or A Java.Net Computer (Sas) On A Microsoft Microsoft Server (Sasa) On An Ipo (Sauge) Or A Microsas (Sask

Using Actian PSQL as a Data Store with VMware vfabric SQLFire. Actian PSQL White Paper May 2013

Fast Innovation requires Fast IT

Greenplum Database 4.0 Connectivity Tools for Windows

SOLUTION BRIEF. JUST THE FAQs: Moving Big Data with Bulk Load.

Using DataDirect Connect for JDBC with Oracle Real Application Clusters (RAC)

2015, André Melancia (Andy.PT) 1

DB2 Connect for NT and the Microsoft Windows NT Load Balancing Service

Database Connectivity for Critical Business Systems: An Application Architect s Guide

Real-time Data Replication

Chapter 4 IT Infrastructure and Platforms

Database Access Through Java Technologies

DATABASDESIGN FÖR INGENJÖRER - 1DL124

Web. Studio. Visual Studio. iseries. Studio. The universal development platform applied to corporate strategy. Adelia.

White Paper: 1) Architecture Objectives: The primary objective of this architecture is to meet the. 2) Architecture Explanation

An Intelligent Approach for Integrity of Heterogeneous and Distributed Databases Systems based on Mobile Agents

Introduction to CORBA. 1. Introduction 2. Distributed Systems: Notions 3. Middleware 4. CORBA Architecture

Deploying Oracle Business Intelligence Publisher in J2EE Application Servers Release

CSI 2132 Lab 8. Outline. Web Programming JSP 23/03/2012

A Layered Architecture based on Java for Internet and Intranet Information Systems

EVALUATION OF SERVER-SIDE TECHNOLOGY FOR WEB DEPLOYMENT

<Insert Picture Here> Move to Oracle Database with Oracle SQL Developer Migrations

OWB Users, Enter The New ODI World

DB2 Application Development and Migration Tools

Microsoft SQL Server Features that can be used with the IBM i

Windows Authentication on Microsoft SQL Server

Database-driven library system

Accesssing External Databases From ILE RPG (with help from Java)

Client Connectivity for Oracle Rdb

Various Load Testing Tools

CatDV Pro Workgroup Serve r

Session 12 Evolving IT Architectures: From Mainframes to Client-Server to Network Computing

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

HP OO 10.X - SiteScope Monitoring Templates

Equipment Room Database and Web-Based Inventory Management

Heterogeneous Data Replication

Using Apache Derby in the real world

CS346: Database Programming.

DISTRIBUTED AND PARALLELL DATABASE

Transcription:

Java and Database JDBC

Contents Client-Server JDBC JDBC Drivers JDBC API 2

Client-Server The Architecture

Introduction A Client is defined as a requester of services and a Server is defined as the provider of services. The term client/server was first used in the 1980s in reference to personal computers (PCs) on a network. The client/server architecture is a versatile and modular infrastructure. 4

Cont d It is intended to improve usability, flexibility, interoperability, and scalability of an application. 5

Advantages This approach introduced a DB server to replace the file server. Using a relational database management system (DBMS), user queries could be answered directly. This architecture reduced network traffic by providing a query response rather than total file transfer. 6

Cont d It improves multi-user updating through a GUI front end to a shared database. In this architectures structured query language (SQL) statements are typically used to communicate between the client and server. 7

Architectures This architecture of Client-Server is referred to as Application Tier architecture. Few well known are Two-Tier Three-Tier N-Tier 8

Two-Tier Architecture Client Tier Data Tier GUI Client Database Storage 9

Three-Tier Architecture Client Tier Middle Tier Data Tier Web Client GUI Client Business Logic Database Storage 10

N-Tier Architecture Client Tier Middle Tier Data Tier Web Client GUI Client Business Logic Transaction Manager Message Server Database Storage 11

JDBC The API

Introduction Java Database Connectivity API API=Application Programmer s Interface Java specific PI to Databases Compare to ODBC 13

Cont d JDBC is overall API for connecting to databases Low-level JDBC Driver developers use JDBC to make JDBC drivers High-level Java developers use JDBC to call JDBC driver to access databases 14

Why JDBC??? DBMS independent interface generic SQL database access framework uniform interface to different data sources 15

JDBC Just another API It s a series of inter-connected classes & interfaces It s just Java JDBC drivers actually do all of the real work Contain routines for connecting, querying, etc for its database Explicitly or Implicitly create instance of driver 16

JDBC Drivers Types

Types of JDBC Drivers There are four basic types of drivers available for JDBC Each one has a specific use Each one has specific limitation 18

Type I This driver type is the JDBC-ODBC bridge It is limited to running locally Must have ODBC installed on computer Must have ODBC driver for specific database installed on computer Generally can t run inside an applet because of Native Method calls 19

JDBC-ODBC Bridge Driver Client Machine Java Application JDBC-ODBC Bridge Server Machine ODBC Driver Database Server Vendor DB Library DB 20

Type II Native Database library driver Uses Native Database library on computer to access database Generally can t run inside an applet because of Native Method calls Must have database library installed on client example: DB-lib for Sybase, Oracle, MS-SQL server 21

Native-API/Partly Java Driver Client Machine Java Application Native-API/ Partly Java Driver Server Machine Database Server Vendor DB Library DB 22

Type III 100% Java Driver, NO native methods Does NOT require pre-installation on client Can be downloaded and configured on-thefly just like any Java class file Uses a proprietary protocol for talking with a middleware server Middleware server converts from proprietary calls to DBMS specific calls 23

Net-Protocol/All-Java Driver Client Machine Java Application Net-Protocol/ All- Java Driver Server Machine Middleware/ Application Server Database Server DB 24

Type IV 100% Java Driver, NO native methods Does NOT require pre-installation on client Can be downloaded and configured on-thefly just like any Java class file Unlike Type III driver, talks DIRECTLY with DBMS server Converts JDBC calls directly to database specific calls 25

Native-Protocol/Pure Java Driver Client Machine Java Application Server Machine Database Server Native-Protocol/ Pure Java Driver DB 26

Which driver to use??? Type I driver is handy for prototyping Type III driver adds security, caching, and connection control Type III and Type IV drivers need no preinstallation Preferred by 9 out of 10 Java developers: Type IV 27

JDBC Portability Type IV and Type III drivers are truly portable Other two aren t portable across OS platforms 28

JDBC API Programming

Introduction JDBC API package is java.sql There are few steps to be remembered Identifying appropriate driver Registering driver to the driver manager Requesting connection to the manager Creating statement Getting the result back 30

Identifying driver There are four JDBC driver types We ll be either using I or IV For Type-I the driver name is sun.jdbc.odbc.jdbcodbcdriver For Type-IV Oracle driver is oracle.jdbc.driver.oracledriver For Type-IV DB2 driver is com.ibm.db2.jdbc.db2driver 31

Where to find the driver JDBC-ODBC Bridge driver comes along the JDK Oracle driver can be found in oracle installed directory hierarchy ora9x/jdbc/lib/classes12.jar IBM DB2 driver can be found in db2 installed directory hierarchy SQLLIB/java/db2java.jar 32

Registering driver There are couple of ways to register a JDBC driver to the driver manager Class.forName() It takes the classpath as a String DriverManager.registerDriver() It needs the handle of the driver instance 33

Requesting connection Now here onwards we ll be using interfaces from the java.sql package DriverManager class method getconnection() is used to request the connection Connection is an interface the handle of which reference to the connection given by the manager 34

Cont d For getting connection we have to provide a URL which differ from driver to driver Jdbc-Odbc bridge driver jdbc:odbc:dsn_name Oracle Type-IV driver jdbc:oracle:thin:@host:port:dbname IBM DB2 Type-IV driver jdbc:db2://host:port//dbname 35

Creating statement Here it doesn t only means writing a SQL query it also has more in it Three types of statements can be created using JDBC API Statements can be only after getting the connection object Connection interface provides methods to create statements of all types 36

Cont d Statement (I) For performing sql queries and Batch of statements PreparedStatement (I) For creating Pre-Compiled sql queries CallableStatement (I) For calling Stored Procedures and functions 37

Getting Result For getting and working with the result of the SQL query we have an interface in out API ResultSet (I) It stores the result of the executed statement. It is keeping the record in a logical table format i.e. in rows and cols 38

Thank You Zubair Shaikh me@zubairshaikh.com