SlideShare a Scribd company logo
By
M.YAMUNA DEVI
CSE Department , 10AG1AO568
CONTENTS
Introduction.
Importance of databases.
Jdbc.
Jdbc api,architecture.
Jdbc key components with steps.
Overview of querying a db with
stages.
Advantages and disadvantages.
Conclusion.
Why Java??
>Write once, run anywhere
> Multiple client and server platforms
>

Database independence
> Java can access any database vendor

> Ease of administration
Importance of databases:
we can store our data permanently by using file concept. If we are using file
concept we have some drawbacks.
•.if we want to use file concept we need to know about IO package concept and
can store small amount of data.
•Inserting , deleting, updating in files it takes more time.
•It does not support query language
•In files we store data in the form of text or objects.
to overcome all these problems we go for database software
In database software the data will be stored permanent it supports query
language.
it takes less time for inserting ,deleting ,updating ,retrieve .
in database s/w the data will be stored in table storing in the form of rows
and columns.
some of the database software are
1)oracle
2)mysql
3)sql server
4)DB2


>
odbc is a standard or open application programming
interface (API) for accessing a database.



Handles these requests and converts it into a request
understandable by an individual database system.



Java API for connecting programs written in Java to the
data in relational databases



The standard defined by Sun Microsystems, allowing
individual providers to implement and extend the standard with
their own JDBC drivers.


>

Tasks of JDBC:
1) establishes a connection with a database
2) sends SQL statements
3) processes the results
JDBC key components:
Driver Manager , Connection , Statement , Result Set
• Driver Manager handles communication with different
drivers that conform to JDBC Driver API
• The static class Driver Manager manages the loaded
drivers and contains methods for accessing connections
to the databases JDBC Driver Manager
Four steps in creating a database
application
Step 1: load a database driver
Step 2: make a database connection
Step 3: create and execute SQL statement
Step 4: process the result set , if necessary
Step 1: Loading a Driver
•Loading a driver requires class name of the driver
•For JDBC-ODBC driver the class name is: sun. jdbc.Odbc .JdbcOdbcDriver
try {
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
}
•The class definition of the driver is loaded using forName static method
of the class Class (in package java.lang )
• catch (Exception e)
{
System.out.println(e);
}
Step 2: Opening a Database Connection
• Connection is an interface defined in java.sql package.
A Connection object represents a connection with the
database.
The interface has methods to create statements which
can be used to manipulate the database.
Connection
cn=DriverManager.getConnection(“jdbc:odbc:ora”,”yamu
na”,”ace”);
Step 3: Creating Statement & executing SQL
Statements
Connection objects can be used to create statement
objects.
Statement = cn.createStatement();
Statement is an interface that contains methods for
executing SQL queries
Like executeUpdate()-insert,delet,update
For selection we refer executeQuery()
Step4:Retrieving the data from db
Individual column fields can be retrieved using
the get methods within the ResultSet.
String qry=“select *from employs”;
ResultSet rs=stmt.executeQuery(qry);
String id=rs.getString(1);
Resultset is the return type of executeQuery().
Columns may be specified by their field name or
by their index.
Connect

Query

Process
results

Close
Connect

Register the driver

Query

Connect to the database

Process
results

Close
Connect

Query

Create a statement

Process
results

Query the database

Close
Connect

Query
Step through the results

Process
results

Close

Assign results to Java
variables
Connect

Query
Close the result set
Process
results

Close the statement

Close

Close the connection
Advantages
1) Can read any database if proper drivers are installed.
2) Query and Stored procedure supported.

Disadvantages
1) Correct drivers need to be deployed for each type
of database
2) Cannot update or insert multiple tables with
sequence. ( Sequence is always random)
Conclusion
JDBC provides API or Protocol to interact with different databases.
With the help of JDBC driver we can connect with different types of
databases
This technology is an API for the java programming language that defines
how a client may access a database. It provides methods for querying
and updating data in a database. JDBC is oriented towards relational
databases. A JDBC-to-ODBC bridge enables connections to any ODBCaccessible data source in the JVM host environment.
References
http://www.oracle.com/technetork/java/javase/jdbc/index.h
tml.
http://docs.oracle.com/javase/tutorial/jdbc/
http://www.webopedia.com/TERM/J/JDBC.html
http://infolab.stanford.edu/~ullman/fcdb/oracle/orjdbc.html
Thank You !!!
ANY QUERIES?

More Related Content

What's hot

JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
Cognizant
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
Ranjith Sekar
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
nationalmobileapps
 
Java CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseJava CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server Database
Dudy Ali
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
Elizabeth Thomas
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
BG Java EE Course
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
Manisha Keim
 
Java database connectivity with MYSQL
Java database connectivity with MYSQLJava database connectivity with MYSQL
Java database connectivity with MYSQL
Adil Mehmoood
 
Database Access With JDBC
Database Access With JDBCDatabase Access With JDBC
Database Access With JDBC
Dharani Kumar Madduri
 
Flutter presentation.pptx
Flutter presentation.pptxFlutter presentation.pptx
Flutter presentation.pptx
FalgunSorathiya
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
madhavi patil
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
prabhu rajendran
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
DrSonali Vyas
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
Maksym Davydov
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
Spotle.ai
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
Santosh Kumar Kar
 

What's hot (20)

JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
JDK,JRE,JVM
JDK,JRE,JVMJDK,JRE,JVM
JDK,JRE,JVM
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 
OOPs in Java
OOPs in JavaOOPs in Java
OOPs in Java
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Java CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseJava CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server Database
 
Basics of JAVA programming
Basics of JAVA programmingBasics of JAVA programming
Basics of JAVA programming
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Java database connectivity with MYSQL
Java database connectivity with MYSQLJava database connectivity with MYSQL
Java database connectivity with MYSQL
 
Database Access With JDBC
Database Access With JDBCDatabase Access With JDBC
Database Access With JDBC
 
Flutter presentation.pptx
Flutter presentation.pptxFlutter presentation.pptx
Flutter presentation.pptx
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
 
GRID VIEW PPT
GRID VIEW PPTGRID VIEW PPT
GRID VIEW PPT
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 

Similar to Jdbc

Unit 5.pdf
Unit 5.pdfUnit 5.pdf
Unit 5.pdf
saturo3011
 
Jdbc
JdbcJdbc
Jdbc connectivity
Jdbc connectivityJdbc connectivity
Jdbc connectivity
arikazukito
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet Solution
Mazenetsolution
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
Pooja Talreja
 
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
 
Module4_Annotations_JDBC.pdf
Module4_Annotations_JDBC.pdfModule4_Annotations_JDBC.pdf
Module4_Annotations_JDBC.pdf
RoopeshGT
 
Core jdbc basics
Core jdbc basicsCore jdbc basics
Core jdbc basics
Sourabrata Mukherjee
 
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
Hemo Chella
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivitybackdoor
 
java.pptx
java.pptxjava.pptx
java.pptx
bfgd1
 
Jdbc
JdbcJdbc
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Java Data Base Connectivity concepts.pptx
Java Data Base Connectivity concepts.pptxJava Data Base Connectivity concepts.pptx
Java Data Base Connectivity concepts.pptx
mukeshprasanth909
 
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 (database in java)
Jdbc (database in java)Jdbc (database in java)
Jdbc (database in java)Maher Abdo
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
Arumugam90
 

Similar to Jdbc (20)

Unit 5.pdf
Unit 5.pdfUnit 5.pdf
Unit 5.pdf
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc connectivity
Jdbc connectivityJdbc connectivity
Jdbc connectivity
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet Solution
 
JDBC.ppt
JDBC.pptJDBC.ppt
JDBC.ppt
 
JDBC
JDBCJDBC
JDBC
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (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
 
Module4_Annotations_JDBC.pdf
Module4_Annotations_JDBC.pdfModule4_Annotations_JDBC.pdf
Module4_Annotations_JDBC.pdf
 
Core jdbc basics
Core jdbc basicsCore jdbc basics
Core jdbc basics
 
Chap3 3 12
Chap3 3 12Chap3 3 12
Chap3 3 12
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
 
java.pptx
java.pptxjava.pptx
java.pptx
 
Jdbc
JdbcJdbc
Jdbc
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Java Data Base Connectivity concepts.pptx
Java Data Base Connectivity concepts.pptxJava Data Base Connectivity concepts.pptx
Java Data Base Connectivity concepts.pptx
 
Jdbc introduction
Jdbc introductionJdbc introduction
Jdbc introduction
 
4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt4-INTERDUCATION TO JDBC-2019.ppt
4-INTERDUCATION TO JDBC-2019.ppt
 
Jdbc (database in java)
Jdbc (database in java)Jdbc (database in java)
Jdbc (database in java)
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
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
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
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
 
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
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
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
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
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
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
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
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
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 !
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
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
 
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
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
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)
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
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 -...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
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...
 

Jdbc

  • 2. CONTENTS Introduction. Importance of databases. Jdbc. Jdbc api,architecture. Jdbc key components with steps. Overview of querying a db with stages. Advantages and disadvantages. Conclusion.
  • 3. Why Java?? >Write once, run anywhere > Multiple client and server platforms > Database independence > Java can access any database vendor > Ease of administration
  • 4. Importance of databases: we can store our data permanently by using file concept. If we are using file concept we have some drawbacks. •.if we want to use file concept we need to know about IO package concept and can store small amount of data. •Inserting , deleting, updating in files it takes more time. •It does not support query language •In files we store data in the form of text or objects. to overcome all these problems we go for database software
  • 5. In database software the data will be stored permanent it supports query language. it takes less time for inserting ,deleting ,updating ,retrieve . in database s/w the data will be stored in table storing in the form of rows and columns. some of the database software are 1)oracle 2)mysql 3)sql server 4)DB2
  • 6.  > odbc is a standard or open application programming interface (API) for accessing a database.  Handles these requests and converts it into a request understandable by an individual database system.  Java API for connecting programs written in Java to the data in relational databases  The standard defined by Sun Microsystems, allowing individual providers to implement and extend the standard with their own JDBC drivers. 
  • 7. > Tasks of JDBC: 1) establishes a connection with a database 2) sends SQL statements 3) processes the results
  • 8. JDBC key components: Driver Manager , Connection , Statement , Result Set • Driver Manager handles communication with different drivers that conform to JDBC Driver API • The static class Driver Manager manages the loaded drivers and contains methods for accessing connections to the databases JDBC Driver Manager
  • 9. Four steps in creating a database application Step 1: load a database driver Step 2: make a database connection Step 3: create and execute SQL statement Step 4: process the result set , if necessary
  • 10. Step 1: Loading a Driver •Loading a driver requires class name of the driver •For JDBC-ODBC driver the class name is: sun. jdbc.Odbc .JdbcOdbcDriver try { Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); } •The class definition of the driver is loaded using forName static method of the class Class (in package java.lang ) • catch (Exception e) { System.out.println(e); }
  • 11. Step 2: Opening a Database Connection • Connection is an interface defined in java.sql package. A Connection object represents a connection with the database. The interface has methods to create statements which can be used to manipulate the database. Connection cn=DriverManager.getConnection(“jdbc:odbc:ora”,”yamu na”,”ace”);
  • 12. Step 3: Creating Statement & executing SQL Statements Connection objects can be used to create statement objects. Statement = cn.createStatement(); Statement is an interface that contains methods for executing SQL queries Like executeUpdate()-insert,delet,update For selection we refer executeQuery()
  • 13. Step4:Retrieving the data from db Individual column fields can be retrieved using the get methods within the ResultSet. String qry=“select *from employs”; ResultSet rs=stmt.executeQuery(qry); String id=rs.getString(1); Resultset is the return type of executeQuery(). Columns may be specified by their field name or by their index.
  • 15. Connect Register the driver Query Connect to the database Process results Close
  • 17. Connect Query Step through the results Process results Close Assign results to Java variables
  • 18. Connect Query Close the result set Process results Close the statement Close Close the connection
  • 19. Advantages 1) Can read any database if proper drivers are installed. 2) Query and Stored procedure supported. Disadvantages 1) Correct drivers need to be deployed for each type of database 2) Cannot update or insert multiple tables with sequence. ( Sequence is always random)
  • 20. Conclusion JDBC provides API or Protocol to interact with different databases. With the help of JDBC driver we can connect with different types of databases This technology is an API for the java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. A JDBC-to-ODBC bridge enables connections to any ODBCaccessible data source in the JVM host environment.