SlideShare a Scribd company logo
JDBC
(Java Database Connectivity)
Introduction
•It is an API (Application Programming Interface)
•Used to connect JAVA application with database
•Interact with different types of databases like,
MS Access, MySQL, Oracle, SQL Server,
PostgreSQL, Sybase
07/01/16 2
JDBC Driver
•Type-1 Driver ( JDBC-ODBC Bridge)
•Type-2 Driver (Native-API Partly Java Driver / Partly Java)
•Type-3 Driver (Network Protocol Driver / Pure Java to Middleware)
•Type-4 Driver (Thin Driver / Pure Java Direct to Database)
07/01/16 3
Type-1 Driver ( JDBC-ODBC Bridge)
•Act as a bridge between JDBC
and other database connectivity
mechanism (ODBC)
•Converts JDBC calls into ODBC
calls and redirects the request
to ODBC driver
•Sun provides a JDBC-ODBC
Bridge Driver
07/01/16 4
Type-1 Driver ( JDBC-ODBC Bridge) cont…
•Advantages
Easy to use
Allow easy connectivity to all database supported by the ODBC
Driver
•Disadvantages
Slow execution time
Dependent on ODBC Driver
Uses Java JNI (Native Interface) to make ODBC call
07/01/16 5
Type-2 Driver (Native-API Partly Java Driver /
Partly Java)
•Converts JDBC calls into calls to the
client
API for that database
•Client 
JDBC Driver 
Vendor Client DB Library

DB
07/01/16 6
Type-2 Driver (Native-API Partly Java Driver /
Partly Java) cont…
•Advantages
Better performance than Type-1 because no JDBC to ODBC
translation is needed.
•Disadvantages
Vendor client library needs to be installed on the client machine.
Can not be used in web-based application due the client side s/w
needed.
Not all database have a client side library.
07/01/16 7
Type-3 Driver (Network Protocol Driver / Pure
Java to Middleware)
•Follow three tier communication
approach
•Can interface to multiple databases
•Client 
JDBC Driver 
Middleware-Net Server 
Any Database
07/01/16 8
Type-3 Driver (Network Protocol Driver / Pure
Java to Middleware) cont…
•Advantages
Does not require any native library to be installed.
Database Independency
Provide facility to switch over from one database to another
database
•Disadvantages
Slow due to increase number of network call
07/01/16 9
Type-4 Driver (Thin Driver / Pure Java Direct
to Database)
•Interact directly with database
•Does not require any native
database
library
•Called pure Java Driver
•Also known as Thin Driver
07/01/16 10
Type-4 Driver (Thin Driver / Pure Java Direct
to Database)
•Advantages
Does not require any native library
Does not require any Middleware server
Better Performance than other driver
•Disadvantages
Slow due to increase number of n/w call
At client side, a separate driver is needed for each database
07/01/16 11
Classes / Interfaces (java.sql package)
07/01/16 12
Connection Interface
Method Description
void close() This method frees the connection object’s database and other JDBC
resources
void commit() This method makes all the changes made since the last commit or
rollback. It throws SQLException
boolean isClosed() This method returns “true” if the connection is close else returns
“false”
void rollback() This method undoes all changes made to the database
Statement createStatement() This method creates a Statement object for sending SQL statements
to the database. throws SQLException
CallableStatement
prepareCall(String s)
This method creates a CallableStatement object for calling stored
procedures. It throws SQLException
PreparedStatement
prepareStatement(String s)
This method creates a PreparedStatement object for sending SQL
statements with or without IN parameter. It throws SQLException.
07/01/16 13
Statement Interface
Method Description
void close() this method releases the statement object’s database and JDBC
resources
boolean execute(String s) This method executes the SQL statement specified by s.
ResultSet executeQuery(String s) This method executes the SQL statement specified by s and returns
the ResultSet object
int executeUpdate(String s) This method executes the SQL statement specified by s. These
statements may be INSERT, UPDATE or DELETE
int getMaxRows() This method returns the maximum number of rows that are
generated by the executeQuery() method
ResultSet getResultSet() This method retrieves the ResultSet generated by the execute()
method
07/01/16 14

More Related Content

What's hot

Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
Kasun Madusanke
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
Amit Baghel
 
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#
Rizwan Ali
 
JDBC ppt
JDBC pptJDBC ppt
JDBC ppt
Rohit Jain
 
JDBC Architecture and Drivers
JDBC Architecture and DriversJDBC Architecture and Drivers
JDBC Architecture and Drivers
SimoniShah6
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
Manisha Keim
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
kamal kotecha
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
Vikas Jagtap
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
Vikas Jagtap
 
Spring boot
Spring bootSpring boot
Spring boot
Pradeep Shanmugam
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
Peter R. Egli
 
Implicit object.pptx
Implicit object.pptxImplicit object.pptx
Implicit object.pptx
chakrapani tripathi
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
Aneega
 
Introduction to c#
Introduction to c#Introduction to c#
Java Servlets
Java ServletsJava Servlets
Java Servlets
BG Java EE Course
 
Java Servlets
Java ServletsJava Servlets

What's hot (20)

Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#
 
JDBC ppt
JDBC pptJDBC ppt
JDBC ppt
 
JDBC Architecture and Drivers
JDBC Architecture and DriversJDBC Architecture and Drivers
JDBC Architecture and Drivers
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Spring boot
Spring bootSpring boot
Spring boot
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Enterprise Java Beans - EJB
Enterprise Java Beans - EJBEnterprise Java Beans - EJB
Enterprise Java Beans - EJB
 
Implicit object.pptx
Implicit object.pptxImplicit object.pptx
Implicit object.pptx
 
MongoDB
MongoDBMongoDB
MongoDB
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 

Viewers also liked

Java Beans
Java BeansJava Beans
Java Beans
Ankit Desai
 
Presentation15 parse xml
Presentation15 parse xmlPresentation15 parse xml
Presentation15 parse xml
Ankit Desai
 
Presentation14 audio play
Presentation14 audio playPresentation14 audio play
Presentation14 audio play
Ankit Desai
 
Presentation11 sq lite
Presentation11 sq litePresentation11 sq lite
Presentation11 sq lite
Ankit Desai
 
Presentation8 silder switch_progress
Presentation8 silder switch_progressPresentation8 silder switch_progress
Presentation8 silder switch_progress
Ankit Desai
 
Presentation4 date picker
Presentation4 date pickerPresentation4 date picker
Presentation4 date picker
Ankit Desai
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installation
Ankit Desai
 
java code and document security
java code and document securityjava code and document security
java code and document security
Ankit Desai
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
knutmork
 
java drag and drop and data transfer
java drag and drop and data transferjava drag and drop and data transfer
java drag and drop and data transfer
Ankit Desai
 
Java Generics
Java GenericsJava Generics
Java Generics
Zülfikar Karakaya
 
Java Generics
Java GenericsJava Generics
Java Generics
jeslie
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 

Viewers also liked (20)

Java Beans
Java BeansJava Beans
Java Beans
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
Presentation15 parse xml
Presentation15 parse xmlPresentation15 parse xml
Presentation15 parse xml
 
Presentation14 audio play
Presentation14 audio playPresentation14 audio play
Presentation14 audio play
 
Presentation11 sq lite
Presentation11 sq litePresentation11 sq lite
Presentation11 sq lite
 
Presentation8 silder switch_progress
Presentation8 silder switch_progressPresentation8 silder switch_progress
Presentation8 silder switch_progress
 
Presentation4 date picker
Presentation4 date pickerPresentation4 date picker
Presentation4 date picker
 
Hadoop installation
Hadoop installationHadoop installation
Hadoop installation
 
java code and document security
java code and document securityjava code and document security
java code and document security
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
 
Java AWT
Java AWTJava AWT
Java AWT
 
java drag and drop and data transfer
java drag and drop and data transferjava drag and drop and data transfer
java drag and drop and data transfer
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Event handling
Event handlingEvent handling
Event handling
 
Bean Intro
Bean IntroBean Intro
Bean Intro
 
Java bean
Java beanJava bean
Java bean
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Java beans
Java beansJava beans
Java beans
 
Javabeans
JavabeansJavabeans
Javabeans
 

Similar to java Jdbc

Java unit 14
Java unit 14Java unit 14
Java unit 14
Shipra Swati
 
Unit 5.pdf
Unit 5.pdfUnit 5.pdf
Unit 5.pdf
saturo3011
 
java.pptx
java.pptxjava.pptx
java.pptx
bfgd1
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Core jdbc basics
Core jdbc basicsCore jdbc basics
Core jdbc basics
Sourabrata Mukherjee
 
JDBC java database connectivity with dbms
JDBC java database connectivity with dbmsJDBC java database connectivity with dbms
JDBC java database connectivity with dbms
KhyalNayak
 
Jdbc driver types
Jdbc driver typesJdbc driver types
Jdbc driver types
Soham Kansodaria
 
jdbc
jdbcjdbc
jdbc
shreeuva
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
Pooja Talreja
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt
NaveenKumar648465
 
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
kingkolju
 
Jdbc complete
Jdbc completeJdbc complete
Jdbc complete
Sandeep Rawat
 
Jdbc
JdbcJdbc
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
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
Hemo Chella
 

Similar to java Jdbc (20)

Java unit 14
Java unit 14Java unit 14
Java unit 14
 
Unit 5.pdf
Unit 5.pdfUnit 5.pdf
Unit 5.pdf
 
java.pptx
java.pptxjava.pptx
java.pptx
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Core jdbc basics
Core jdbc basicsCore jdbc basics
Core jdbc basics
 
Jdbc introduction
Jdbc introductionJdbc introduction
Jdbc introduction
 
JDBC java database connectivity with dbms
JDBC java database connectivity with dbmsJDBC java database connectivity with dbms
JDBC java database connectivity with dbms
 
jdbc
jdbcjdbc
jdbc
 
Jdbc driver types
Jdbc driver typesJdbc driver types
Jdbc driver types
 
jdbc
jdbcjdbc
jdbc
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt
 
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
 
Jdbc complete
Jdbc completeJdbc complete
Jdbc complete
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
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
 
3 jdbc
3 jdbc3 jdbc
3 jdbc
 
jdbc document
jdbc documentjdbc document
jdbc document
 
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
 

More from Ankit Desai

Java RMI
Java RMIJava RMI
Java RMI
Ankit Desai
 
java swing programming
java swing programming java swing programming
java swing programming
Ankit Desai
 
Java Networking
Java NetworkingJava Networking
Java Networking
Ankit Desai
 
JDBC
JDBCJDBC
Presentation10 view navigation
Presentation10 view navigationPresentation10 view navigation
Presentation10 view navigation
Ankit Desai
 
Presentation7 segment control
Presentation7 segment controlPresentation7 segment control
Presentation7 segment control
Ankit Desai
 
Presentation6 ui image_view
Presentation6 ui image_viewPresentation6 ui image_view
Presentation6 ui image_view
Ankit Desai
 
Presentation5 picker view
Presentation5 picker viewPresentation5 picker view
Presentation5 picker view
Ankit Desai
 
Presentation3 actionsheet alertview
Presentation3 actionsheet alertviewPresentation3 actionsheet alertview
Presentation3 actionsheet alertview
Ankit Desai
 
Presentation1 password
Presentation1 passwordPresentation1 password
Presentation1 password
Ankit Desai
 
Presentation2 gesture control
Presentation2 gesture controlPresentation2 gesture control
Presentation2 gesture control
Ankit Desai
 

More from Ankit Desai (11)

Java RMI
Java RMIJava RMI
Java RMI
 
java swing programming
java swing programming java swing programming
java swing programming
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
JDBC
JDBCJDBC
JDBC
 
Presentation10 view navigation
Presentation10 view navigationPresentation10 view navigation
Presentation10 view navigation
 
Presentation7 segment control
Presentation7 segment controlPresentation7 segment control
Presentation7 segment control
 
Presentation6 ui image_view
Presentation6 ui image_viewPresentation6 ui image_view
Presentation6 ui image_view
 
Presentation5 picker view
Presentation5 picker viewPresentation5 picker view
Presentation5 picker view
 
Presentation3 actionsheet alertview
Presentation3 actionsheet alertviewPresentation3 actionsheet alertview
Presentation3 actionsheet alertview
 
Presentation1 password
Presentation1 passwordPresentation1 password
Presentation1 password
 
Presentation2 gesture control
Presentation2 gesture controlPresentation2 gesture control
Presentation2 gesture control
 

Recently uploaded

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 

Recently uploaded (20)

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 

java Jdbc

  • 2. Introduction •It is an API (Application Programming Interface) •Used to connect JAVA application with database •Interact with different types of databases like, MS Access, MySQL, Oracle, SQL Server, PostgreSQL, Sybase 07/01/16 2
  • 3. JDBC Driver •Type-1 Driver ( JDBC-ODBC Bridge) •Type-2 Driver (Native-API Partly Java Driver / Partly Java) •Type-3 Driver (Network Protocol Driver / Pure Java to Middleware) •Type-4 Driver (Thin Driver / Pure Java Direct to Database) 07/01/16 3
  • 4. Type-1 Driver ( JDBC-ODBC Bridge) •Act as a bridge between JDBC and other database connectivity mechanism (ODBC) •Converts JDBC calls into ODBC calls and redirects the request to ODBC driver •Sun provides a JDBC-ODBC Bridge Driver 07/01/16 4
  • 5. Type-1 Driver ( JDBC-ODBC Bridge) cont… •Advantages Easy to use Allow easy connectivity to all database supported by the ODBC Driver •Disadvantages Slow execution time Dependent on ODBC Driver Uses Java JNI (Native Interface) to make ODBC call 07/01/16 5
  • 6. Type-2 Driver (Native-API Partly Java Driver / Partly Java) •Converts JDBC calls into calls to the client API for that database •Client  JDBC Driver  Vendor Client DB Library  DB 07/01/16 6
  • 7. Type-2 Driver (Native-API Partly Java Driver / Partly Java) cont… •Advantages Better performance than Type-1 because no JDBC to ODBC translation is needed. •Disadvantages Vendor client library needs to be installed on the client machine. Can not be used in web-based application due the client side s/w needed. Not all database have a client side library. 07/01/16 7
  • 8. Type-3 Driver (Network Protocol Driver / Pure Java to Middleware) •Follow three tier communication approach •Can interface to multiple databases •Client  JDBC Driver  Middleware-Net Server  Any Database 07/01/16 8
  • 9. Type-3 Driver (Network Protocol Driver / Pure Java to Middleware) cont… •Advantages Does not require any native library to be installed. Database Independency Provide facility to switch over from one database to another database •Disadvantages Slow due to increase number of network call 07/01/16 9
  • 10. Type-4 Driver (Thin Driver / Pure Java Direct to Database) •Interact directly with database •Does not require any native database library •Called pure Java Driver •Also known as Thin Driver 07/01/16 10
  • 11. Type-4 Driver (Thin Driver / Pure Java Direct to Database) •Advantages Does not require any native library Does not require any Middleware server Better Performance than other driver •Disadvantages Slow due to increase number of n/w call At client side, a separate driver is needed for each database 07/01/16 11
  • 12. Classes / Interfaces (java.sql package) 07/01/16 12
  • 13. Connection Interface Method Description void close() This method frees the connection object’s database and other JDBC resources void commit() This method makes all the changes made since the last commit or rollback. It throws SQLException boolean isClosed() This method returns “true” if the connection is close else returns “false” void rollback() This method undoes all changes made to the database Statement createStatement() This method creates a Statement object for sending SQL statements to the database. throws SQLException CallableStatement prepareCall(String s) This method creates a CallableStatement object for calling stored procedures. It throws SQLException PreparedStatement prepareStatement(String s) This method creates a PreparedStatement object for sending SQL statements with or without IN parameter. It throws SQLException. 07/01/16 13
  • 14. Statement Interface Method Description void close() this method releases the statement object’s database and JDBC resources boolean execute(String s) This method executes the SQL statement specified by s. ResultSet executeQuery(String s) This method executes the SQL statement specified by s and returns the ResultSet object int executeUpdate(String s) This method executes the SQL statement specified by s. These statements may be INSERT, UPDATE or DELETE int getMaxRows() This method returns the maximum number of rows that are generated by the executeQuery() method ResultSet getResultSet() This method retrieves the ResultSet generated by the execute() method 07/01/16 14

Editor's Notes

  1. 1