SlideShare a Scribd company logo
1 of 24
Download to read offline
Advanced Programming
Java Database Connectivity
Gera
2020
1
Introduction
•A database is an organized collection of data.
•There are many different strategies for organizing
data to facilitate easy access and manipulation.
•A database management system (DBMS) provides
mechanisms for storing, organizing, retrieving and
modifying data for many users.
•Database management systems allow for the
access and storage of data without concern for the
internal representation of data. 2
Java Database Connectivity (JDBC)
•JDBC is Java application programming
interface that allows the Java programmers to
access database management system from
the java code.
•It was developed by JavaSoft, a subsidiary of
Sun Microsystems.
•It is a java API which enables the java
programs to execute SQL statements.
3
Java Database Connectivity (JDBC)…
• JDBC provides methods for querying and updating the
data in Relational Database Management system such
as SQL, Oracle etc.
• Generally all Relational Database Management
System supports SQL and we all know that Java is
platform independent.
• So JDBC makes it possible to write a single database
application that can run on different platforms and
interact with different Database Management
Systems. 4
The Structured Query Language SQL
•JDBC is an interface to SQL, which is the interface
to essentially all modern relational databases.
•Desktop databases usually have a graphical user
interfaces that lets users manipulate the data
directly, but server-based databases are accessed
purely through SQL.
•Most desktop databases have a SQL interface as
well, but it often does not support the full range of
ANSI SQL92 features, the current standard for SQL.
5
SQL Basic SELECT Query
• Let us consider several SQL queries that extract information from
database books.
• A SQL query “selects” rows and columns from one or more tables
in a database. Such selections are performed by queries with the
SELECT keyword.
• The basic form of a SELECT query is
SELECT * FROM tableName
in which the asterisk (*) indicates that all columns from the
tableName table should be retrieved.
• For example, to retrieve all the data in the authors table, use
SELECT * FROM authors 6
SQL Basic SELECT Query
• For example, to retrieve only the columns authorID and lastName
for all rows in the authors table, use the query
SELECT authorID, lastName FROM authors
This query returns the data listed as following sample:
7
SQL Basic SELECT Query
• SQL query keywords
8
Installing JDBC
•First, you need a database program that is
compatible with JDBC.
•You will also need to create a database for your
experimental use.
•We assume you will call this database COREJAVA.
•Create a new database, or have your database
administrator create one with the appropriate
permissions. You need to be able to create,
update, and drop tables. 9
Installing JDBC…
• If you have never installed a client/server database
before, you may find that setting up the database is
somewhat complex and that it can be difficult to
diagnose the cause for failure.
• One alternative is to install a pure Java database such
as Cloudscape (http://www.cloudscape.com),
PointBase (http://www.pointbase.com), or InstantDB
(http://www.lutris.com/products/instantDB).
• These databases are less powerful but simple to set
up. 10
Installing JDBC…
•Essentially all database vendors already have
JDBC drivers.
•You need to locate the vendor's instructions
to load the driver into your program and to
connect to the database.
11
Basic JDBC Programming Concepts
•Programming with the JDBC classes is, by
design, not very different from programming
with the usual Java platform classes:
•You build objects from the JDBC core classes,
extending them by inheritance if need be.
12
Components of JDBC
1. The JDBC API.
2. The JDBC Driver Manager.
3. The JDBC Test Suite.
4. The JDBC-ODBC Bridge.
13
JDBC API
• The JDBC API provides the facility for accessing the
relational database from the Java programming
language.
• The user not only execute the SQL statements, retrieve
results, and update the data but can also access it
anywhere within a network because of it's "Write Once,
Run Anywhere" (WORA) capabilities.
• Due to JDBC API technology, user can also access other
tabular data sources like spreadsheets or flat files even in
the a heterogeneous environment.
14
JDBC API…
• JDBC application programming interface is a part of the
Java platform that have included Java SE and Java EE in
itself.
• The latest version of JDBC 4.0 application programming
interface is divided into two packages.
i) java.sql.
ii) javax.sql.
• Java SE and Java EE platforms are included in both the
packages.
15
JDBC Driver
• A JDBC driver translates standard JDBC calls into a
network or database protocol OR into a database library
API call that facilitates communication with the
database.
• There are four distinct types of JDBC drivers.
1. JDBC-ODBC Bridge + ODBC Driver, also called as Type1
2. Native API , Pure/partly Java Driver, also called Type 2.
3. JDBC –Net Pure Java Driver, also called Type 3.
4. Native Protocol , Pure Java Driver, also called Type 4.
16
JDBC Driver Manager
• The JDBC Driver Manager is a very important class that
defines objects which connect Java applications to a
JDBC driver.
• Usually Driver Manager is the backbone of the JDBC
architecture.
• It's very simple and small that is used to provide a means
of managing the different types of JDBC database driver
running on an application.
17
JDBC Driver Manager…
•The main responsibility of JDBC database driver is
to load all the drivers found in the system properly
as well as to select the most appropriate driver
from opening a connection to a database.
•The Driver Manager also helps to select the most
appropriate driver from the previously loaded
drivers when a new open database is connected.
18
JDBC Test Suite
•The function of JDBC driver test suite is to make
ensure that the JDBC drivers will run user's
program or not .
•The test suite of JDBC application program
interface is very useful for testing a driver based
on JDBC technology during testing period.
•It ensures the requirement of Java Platform
Enterprise Edition (J2EE).
19
ODBC (Open Data Base Connectivity)
•Open DataBase Connectivity is similar to Java
Database Connectivity which is used for
accessing and managing database, but the
difference is that JDBC is designed specifically
for Java programs, whereas ODBC is not
depended upon any language.
20
JDBC-ODBC Bridge
•The JDBC-ODBC bridge, also known as JDBC type 1
driver is a database driver that utilize the ODBC
driver to connect the database.
•This driver translates JDBC method calls into ODBC
function calls.
•The Bridge implements Jdbc for any database for
which an Odbc driver is available.
•The Bridge is always implemented as the
sun.jdbc.odbc Java package and it contains a 21
Functions of JDBC-ODBC Bridge
•Translates query obtained by JDBC into
corresponding ODBC query, which is then handled
by the ODBC driver.
•Sun provides a JDBC-ODBC Bridge driver.
sun.jdbc.odbc.JdbcOdbcDriver. This driver is
native code and not Java, and is closed source.
•Client -> JDBC Driver -> ODBC Driver -> Database
•There is some overhead associated with the
translation work to go from JDBC to ODBC. 22
Components of JDBC
•This first two component of JDBC, the JDBC API
and the JDBC Driver Manager manages to connect
to the database and then build a java program that
utilizes SQL commands to communicate with any
RDBMS.
•On the other hand, the last two components are
used to communicate with ODBC or to test web
application in the specialized environment.
23
References
➢S. Horstmann and Gary Cornell, Core Java 2 – Volume II-
Advanced Features, Sun Microsystems Press
➢Harvey M. Deitel and Paul J. Deitel, Java How to
Program, Deitel & Associates
➢Nitesh Kukreja and Pooja Talreja, “An introduction to
java connectivity (JDBC),”
24
Gerabirhan Paulos
ToCourseInfo@gmail.com

More Related Content

What's hot

JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...Pallepati Vasavi
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Modelkunj desai
 
JDBC Architecture and Drivers
JDBC Architecture and DriversJDBC Architecture and Drivers
JDBC Architecture and DriversSimoniShah6
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionMazenetsolution
 
Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)suraj pandey
 
Jdbc (database in java)
Jdbc (database in java)Jdbc (database in java)
Jdbc (database in java)Maher Abdo
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types pptkamal kotecha
 
Types of Drivers in JDBC
Types of Drivers in JDBCTypes of Drivers in JDBC
Types of Drivers in JDBCHemant Sharma
 
Java DataBase Connectivity API (JDBC API)
Java DataBase Connectivity API (JDBC API)Java DataBase Connectivity API (JDBC API)
Java DataBase Connectivity API (JDBC API)Luzan Baral
 
java database connection (jdbc)
java database connection (jdbc)java database connection (jdbc)
java database connection (jdbc)Sanjay Gunjal
 

What's hot (20)

JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
 
Jdbc
JdbcJdbc
Jdbc
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 
JDBC Architecture and Drivers
JDBC Architecture and DriversJDBC Architecture and Drivers
JDBC Architecture and Drivers
 
Jdbc
JdbcJdbc
Jdbc
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet Solution
 
Jdbc_ravi_2016
Jdbc_ravi_2016Jdbc_ravi_2016
Jdbc_ravi_2016
 
Jdbc driver types
Jdbc driver typesJdbc driver types
Jdbc driver types
 
Jdbc
JdbcJdbc
Jdbc
 
Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)Basic Java Database Connectivity(JDBC)
Basic Java Database Connectivity(JDBC)
 
JDBC
JDBCJDBC
JDBC
 
Jdbc (database in java)
Jdbc (database in java)Jdbc (database in java)
Jdbc (database in java)
 
Jdbc driver types
Jdbc driver typesJdbc driver types
Jdbc driver types
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
Types of Drivers in JDBC
Types of Drivers in JDBCTypes of Drivers in JDBC
Types of Drivers in JDBC
 
Jdbc complete
Jdbc completeJdbc complete
Jdbc complete
 
Java DataBase Connectivity API (JDBC API)
Java DataBase Connectivity API (JDBC API)Java DataBase Connectivity API (JDBC API)
Java DataBase Connectivity API (JDBC API)
 
JDBC Driver Types
JDBC Driver TypesJDBC Driver Types
JDBC Driver Types
 
Overview Of JDBC
Overview Of JDBCOverview Of JDBC
Overview Of JDBC
 
java database connection (jdbc)
java database connection (jdbc)java database connection (jdbc)
java database connection (jdbc)
 

Similar to Java Database Connectivity (Advanced programming)

Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Pooja Talreja
 
java.pptx
java.pptxjava.pptx
java.pptxbfgd1
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivityVaishali Modi
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.pptNaveenKumar648465
 
chapter 5 java.pptx
chapter 5  java.pptxchapter 5  java.pptx
chapter 5 java.pptxBekiTube
 
Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5Pallepati Vasavi
 
JDBC java for learning java for learn.ppt
JDBC java for learning java for learn.pptJDBC java for learning java for learn.ppt
JDBC java for learning java for learn.pptkingkolju
 
Chapter_4_-_JDBC[1].pptx
Chapter_4_-_JDBC[1].pptxChapter_4_-_JDBC[1].pptx
Chapter_4_-_JDBC[1].pptxBachaSirata
 
Jdbc connectivity
Jdbc connectivityJdbc connectivity
Jdbc connectivityarikazukito
 
JDBC java database connectivity with dbms
JDBC java database connectivity with dbmsJDBC java database connectivity with dbms
JDBC java database connectivity with dbmsKhyalNayak
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdfArumugam90
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdfArumugam90
 

Similar to Java Database Connectivity (Advanced programming) (20)

Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
 
java.pptx
java.pptxjava.pptx
java.pptx
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
java 4 Part 1 computer science.pptx
java 4 Part 1 computer science.pptxjava 4 Part 1 computer science.pptx
java 4 Part 1 computer science.pptx
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt
 
Advanced JAVA
Advanced JAVAAdvanced JAVA
Advanced JAVA
 
Jdbc
JdbcJdbc
Jdbc
 
chapter 5 java.pptx
chapter 5  java.pptxchapter 5  java.pptx
chapter 5 java.pptx
 
Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5
 
JDBC java for learning java for learn.ppt
JDBC java for learning java for learn.pptJDBC java for learning java for learn.ppt
JDBC java for learning java for learn.ppt
 
Chapter_4_-_JDBC[1].pptx
Chapter_4_-_JDBC[1].pptxChapter_4_-_JDBC[1].pptx
Chapter_4_-_JDBC[1].pptx
 
jdbc
jdbcjdbc
jdbc
 
Assignment#10
Assignment#10Assignment#10
Assignment#10
 
Jdbc connectivity
Jdbc connectivityJdbc connectivity
Jdbc connectivity
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc 1
Jdbc 1Jdbc 1
Jdbc 1
 
JDBC java database connectivity with dbms
JDBC java database connectivity with dbmsJDBC java database connectivity with dbms
JDBC java database connectivity with dbms
 
What is JDBC
What is JDBCWhat is JDBC
What is JDBC
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
 

More from Gera Paulos

Networking in java, Advanced programming
Networking in java, Advanced programmingNetworking in java, Advanced programming
Networking in java, Advanced programmingGera Paulos
 
Remote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programmingRemote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programmingGera Paulos
 
Multi Threading Concept (Advanced programming)
Multi Threading Concept (Advanced programming)Multi Threading Concept (Advanced programming)
Multi Threading Concept (Advanced programming)Gera Paulos
 
Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)Gera Paulos
 
Advanced programming ch2
Advanced programming ch2Advanced programming ch2
Advanced programming ch2Gera Paulos
 
Advanced programming ch1
Advanced programming ch1Advanced programming ch1
Advanced programming ch1Gera Paulos
 
Image restoration and enhancement #2
Image restoration and enhancement #2 Image restoration and enhancement #2
Image restoration and enhancement #2 Gera Paulos
 
Introduction to digital image processing #1
Introduction to digital image processing #1Introduction to digital image processing #1
Introduction to digital image processing #1Gera Paulos
 
Implement maintenance procedures
Implement maintenance proceduresImplement maintenance procedures
Implement maintenance proceduresGera Paulos
 
Maintain equipment and consumables
Maintain equipment and consumablesMaintain equipment and consumables
Maintain equipment and consumablesGera Paulos
 
Care for network and computer hardware
Care for network and computer hardwareCare for network and computer hardware
Care for network and computer hardwareGera Paulos
 
Update and document operational procedures
Update and document operational proceduresUpdate and document operational procedures
Update and document operational proceduresGera Paulos
 
Apply quality control
Apply quality controlApply quality control
Apply quality controlGera Paulos
 
Monitoring implementation of work plan
Monitoring implementation of work planMonitoring implementation of work plan
Monitoring implementation of work planGera Paulos
 
Provide first level remote help desk support
Provide first level remote help desk supportProvide first level remote help desk support
Provide first level remote help desk supportGera Paulos
 
Configuring and administrate server
Configuring and administrate serverConfiguring and administrate server
Configuring and administrate serverGera Paulos
 
Identifying and resolving network problems
Identifying and resolving network problemsIdentifying and resolving network problems
Identifying and resolving network problemsGera Paulos
 
Conduct / facilitate user training
Conduct / facilitate user trainingConduct / facilitate user training
Conduct / facilitate user trainingGera Paulos
 
Monitor and administer system and network
Monitor and administer system and network Monitor and administer system and network
Monitor and administer system and network Gera Paulos
 
Creating technical documents
Creating technical documentsCreating technical documents
Creating technical documentsGera Paulos
 

More from Gera Paulos (20)

Networking in java, Advanced programming
Networking in java, Advanced programmingNetworking in java, Advanced programming
Networking in java, Advanced programming
 
Remote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programmingRemote Method Invocation, Advanced programming
Remote Method Invocation, Advanced programming
 
Multi Threading Concept (Advanced programming)
Multi Threading Concept (Advanced programming)Multi Threading Concept (Advanced programming)
Multi Threading Concept (Advanced programming)
 
Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)Servlets as introduction (Advanced programming)
Servlets as introduction (Advanced programming)
 
Advanced programming ch2
Advanced programming ch2Advanced programming ch2
Advanced programming ch2
 
Advanced programming ch1
Advanced programming ch1Advanced programming ch1
Advanced programming ch1
 
Image restoration and enhancement #2
Image restoration and enhancement #2 Image restoration and enhancement #2
Image restoration and enhancement #2
 
Introduction to digital image processing #1
Introduction to digital image processing #1Introduction to digital image processing #1
Introduction to digital image processing #1
 
Implement maintenance procedures
Implement maintenance proceduresImplement maintenance procedures
Implement maintenance procedures
 
Maintain equipment and consumables
Maintain equipment and consumablesMaintain equipment and consumables
Maintain equipment and consumables
 
Care for network and computer hardware
Care for network and computer hardwareCare for network and computer hardware
Care for network and computer hardware
 
Update and document operational procedures
Update and document operational proceduresUpdate and document operational procedures
Update and document operational procedures
 
Apply quality control
Apply quality controlApply quality control
Apply quality control
 
Monitoring implementation of work plan
Monitoring implementation of work planMonitoring implementation of work plan
Monitoring implementation of work plan
 
Provide first level remote help desk support
Provide first level remote help desk supportProvide first level remote help desk support
Provide first level remote help desk support
 
Configuring and administrate server
Configuring and administrate serverConfiguring and administrate server
Configuring and administrate server
 
Identifying and resolving network problems
Identifying and resolving network problemsIdentifying and resolving network problems
Identifying and resolving network problems
 
Conduct / facilitate user training
Conduct / facilitate user trainingConduct / facilitate user training
Conduct / facilitate user training
 
Monitor and administer system and network
Monitor and administer system and network Monitor and administer system and network
Monitor and administer system and network
 
Creating technical documents
Creating technical documentsCreating technical documents
Creating technical documents
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

Java Database Connectivity (Advanced programming)

  • 1. Advanced Programming Java Database Connectivity Gera 2020 1
  • 2. Introduction •A database is an organized collection of data. •There are many different strategies for organizing data to facilitate easy access and manipulation. •A database management system (DBMS) provides mechanisms for storing, organizing, retrieving and modifying data for many users. •Database management systems allow for the access and storage of data without concern for the internal representation of data. 2
  • 3. Java Database Connectivity (JDBC) •JDBC is Java application programming interface that allows the Java programmers to access database management system from the java code. •It was developed by JavaSoft, a subsidiary of Sun Microsystems. •It is a java API which enables the java programs to execute SQL statements. 3
  • 4. Java Database Connectivity (JDBC)… • JDBC provides methods for querying and updating the data in Relational Database Management system such as SQL, Oracle etc. • Generally all Relational Database Management System supports SQL and we all know that Java is platform independent. • So JDBC makes it possible to write a single database application that can run on different platforms and interact with different Database Management Systems. 4
  • 5. The Structured Query Language SQL •JDBC is an interface to SQL, which is the interface to essentially all modern relational databases. •Desktop databases usually have a graphical user interfaces that lets users manipulate the data directly, but server-based databases are accessed purely through SQL. •Most desktop databases have a SQL interface as well, but it often does not support the full range of ANSI SQL92 features, the current standard for SQL. 5
  • 6. SQL Basic SELECT Query • Let us consider several SQL queries that extract information from database books. • A SQL query “selects” rows and columns from one or more tables in a database. Such selections are performed by queries with the SELECT keyword. • The basic form of a SELECT query is SELECT * FROM tableName in which the asterisk (*) indicates that all columns from the tableName table should be retrieved. • For example, to retrieve all the data in the authors table, use SELECT * FROM authors 6
  • 7. SQL Basic SELECT Query • For example, to retrieve only the columns authorID and lastName for all rows in the authors table, use the query SELECT authorID, lastName FROM authors This query returns the data listed as following sample: 7
  • 8. SQL Basic SELECT Query • SQL query keywords 8
  • 9. Installing JDBC •First, you need a database program that is compatible with JDBC. •You will also need to create a database for your experimental use. •We assume you will call this database COREJAVA. •Create a new database, or have your database administrator create one with the appropriate permissions. You need to be able to create, update, and drop tables. 9
  • 10. Installing JDBC… • If you have never installed a client/server database before, you may find that setting up the database is somewhat complex and that it can be difficult to diagnose the cause for failure. • One alternative is to install a pure Java database such as Cloudscape (http://www.cloudscape.com), PointBase (http://www.pointbase.com), or InstantDB (http://www.lutris.com/products/instantDB). • These databases are less powerful but simple to set up. 10
  • 11. Installing JDBC… •Essentially all database vendors already have JDBC drivers. •You need to locate the vendor's instructions to load the driver into your program and to connect to the database. 11
  • 12. Basic JDBC Programming Concepts •Programming with the JDBC classes is, by design, not very different from programming with the usual Java platform classes: •You build objects from the JDBC core classes, extending them by inheritance if need be. 12
  • 13. Components of JDBC 1. The JDBC API. 2. The JDBC Driver Manager. 3. The JDBC Test Suite. 4. The JDBC-ODBC Bridge. 13
  • 14. JDBC API • The JDBC API provides the facility for accessing the relational database from the Java programming language. • The user not only execute the SQL statements, retrieve results, and update the data but can also access it anywhere within a network because of it's "Write Once, Run Anywhere" (WORA) capabilities. • Due to JDBC API technology, user can also access other tabular data sources like spreadsheets or flat files even in the a heterogeneous environment. 14
  • 15. JDBC API… • JDBC application programming interface is a part of the Java platform that have included Java SE and Java EE in itself. • The latest version of JDBC 4.0 application programming interface is divided into two packages. i) java.sql. ii) javax.sql. • Java SE and Java EE platforms are included in both the packages. 15
  • 16. JDBC Driver • A JDBC driver translates standard JDBC calls into a network or database protocol OR into a database library API call that facilitates communication with the database. • There are four distinct types of JDBC drivers. 1. JDBC-ODBC Bridge + ODBC Driver, also called as Type1 2. Native API , Pure/partly Java Driver, also called Type 2. 3. JDBC –Net Pure Java Driver, also called Type 3. 4. Native Protocol , Pure Java Driver, also called Type 4. 16
  • 17. JDBC Driver Manager • The JDBC Driver Manager is a very important class that defines objects which connect Java applications to a JDBC driver. • Usually Driver Manager is the backbone of the JDBC architecture. • It's very simple and small that is used to provide a means of managing the different types of JDBC database driver running on an application. 17
  • 18. JDBC Driver Manager… •The main responsibility of JDBC database driver is to load all the drivers found in the system properly as well as to select the most appropriate driver from opening a connection to a database. •The Driver Manager also helps to select the most appropriate driver from the previously loaded drivers when a new open database is connected. 18
  • 19. JDBC Test Suite •The function of JDBC driver test suite is to make ensure that the JDBC drivers will run user's program or not . •The test suite of JDBC application program interface is very useful for testing a driver based on JDBC technology during testing period. •It ensures the requirement of Java Platform Enterprise Edition (J2EE). 19
  • 20. ODBC (Open Data Base Connectivity) •Open DataBase Connectivity is similar to Java Database Connectivity which is used for accessing and managing database, but the difference is that JDBC is designed specifically for Java programs, whereas ODBC is not depended upon any language. 20
  • 21. JDBC-ODBC Bridge •The JDBC-ODBC bridge, also known as JDBC type 1 driver is a database driver that utilize the ODBC driver to connect the database. •This driver translates JDBC method calls into ODBC function calls. •The Bridge implements Jdbc for any database for which an Odbc driver is available. •The Bridge is always implemented as the sun.jdbc.odbc Java package and it contains a 21
  • 22. Functions of JDBC-ODBC Bridge •Translates query obtained by JDBC into corresponding ODBC query, which is then handled by the ODBC driver. •Sun provides a JDBC-ODBC Bridge driver. sun.jdbc.odbc.JdbcOdbcDriver. This driver is native code and not Java, and is closed source. •Client -> JDBC Driver -> ODBC Driver -> Database •There is some overhead associated with the translation work to go from JDBC to ODBC. 22
  • 23. Components of JDBC •This first two component of JDBC, the JDBC API and the JDBC Driver Manager manages to connect to the database and then build a java program that utilizes SQL commands to communicate with any RDBMS. •On the other hand, the last two components are used to communicate with ODBC or to test web application in the specialized environment. 23
  • 24. References ➢S. Horstmann and Gary Cornell, Core Java 2 – Volume II- Advanced Features, Sun Microsystems Press ➢Harvey M. Deitel and Paul J. Deitel, Java How to Program, Deitel & Associates ➢Nitesh Kukreja and Pooja Talreja, “An introduction to java connectivity (JDBC),” 24 Gerabirhan Paulos ToCourseInfo@gmail.com