SlideShare a Scribd company logo
GANDHINGAR INSTITUTE OF
TECHNOLOGY
INFORMATION TECHNOLOGY DEPARTMENT
ADVANCED JAVA
CREATING JDBC CONNECTION
Enrollment no: 150120116047
Name: Prince Paneliya
Guided By: Prof. Prashant Jani
What is JDBC?
JDBC provides Java applications with access to
most database systems via SQl.
JDBC acronomy of java database connectivity
through Sun Microsystems claims that it is not
the full form.
JDBC is a standard java API for independence
database connection between a java program
and wide range of relational database.
Database Connectivity
Before APIs like JDBC and ODBC, database
connectivity was tedious
Each database vendor provided a function library
for accessing their database
The connectivity library was proprietary.
If the database vendor changed for the application,
the data access portions had to be rewritten
Types of JDBC Drivers
There are four types of jDBC Drivers.
Type 1 - JDBC-ODBC Bridge
Type 2 - JDBC-Native Bridge
Type 3 - JDBC-Net Bridge
Type 4 - Direct JDBC Driver
JDBC-ODBC Bridge
It runs only on platforms where ODBC is available
ODBC must be configured separately
The JDBC-ODBC bridge driver uses ODBC driver to connect to the
database.
The JDBC-ODBC bridge driver converts JDBC method calls into
the ODBC function calls.
Jdbc
api
Java
application
Jdbc-
odbc
driver
Odbc
driver DataB
ase
Vendor
databa
se
JDBC Native Bridge
The Native API driver uses the client-side libraries of the
database.
The driver converts JDBC method calls into native calls
of the database API
Java
application
Jdbc api
Native Api
driver
Vendor
database DataBase
JDBC-Net Bridge
 The Network Protocol driver uses middleware that
converts JDBC calls directly or indirectly into the vendor-
specific database protocol.
 It is fully written in java.
Java
Application
Network
Protocol
layer
Middleware
Databas
e
JDBC
Api
Direct JDBC Driver
 The thin driver converts JDBC calls directly into the
vendor-specific database protocol.
 That is why it is known as thin driver. It is fully written in
Java language.
Java Application
JDBC Api
Thin driver Database
steps to connect JDBC
connection
 There are five steps to connect java
application with the database in java using
JDBC.
1. Register the Driver class.
2. Create the connection object.
3. Create the statement object.
4. Execute the query.
5. Close the connection.
 The forName() method of Class class is used
to register the driver class.
 This method is used to dynamically load the
driver.
syntax:-
Class.forName(“mysql.jdbc.driver.
mysqldriver”);
 The getConnection() method of DriverManager
class is used to establish connection with the
database.
Syntax :-
Connection con =
DriverManager.getConnection(“jd
bc:mysql://localhost:dbname”,”roo
t”,”password”)
 The createStatement() method of Connection
interface is used to create statement.
 The object of statement is responsible to
execute queries with the database.
Syntax:-
Statement
stmt=con.createStatement();
 The executeQuery() method of Statement interface is used to
execute queries to the database.
 This method returns the object of ResultSet that can be used
to get all the records of a table.
Syntax:-
ResultSet rs = stmt.ExecuteQuery(“select *
from table”);
While(rs.next()){
System.out.println(“rs.getInt(1)+“
”+rs.getString(“name”) );
}
 By closing connection object statement and
ResultSet will be closed automatically.
 The close() method of Connection interface is
used to close the connection.
Syntax:-
con.close();
Thank you

More Related Content

PPT
PPTX
Jdbc_ravi_2016
PPT
PPT
PPTX
Java DataBase Connectivity API (JDBC API)
PPSX
JDBC: java DataBase connectivity
PPSX
Fundamentals of JDBC
PDF
Ajp notes-chapter-05
Jdbc_ravi_2016
Java DataBase Connectivity API (JDBC API)
JDBC: java DataBase connectivity
Fundamentals of JDBC
Ajp notes-chapter-05

What's hot (20)

PPTX
Java database connectivity with MySql
PDF
Database and Java Database Connectivity
PPT
JDBC Architecture and Drivers
DOC
jdbc document
PPTX
Java- JDBC- Mazenet Solution
PDF
Jdbc connectivity in java
PPTX
Jdbc drivers
PPT
Jdbc (database in java)
PPT
Java database connectivity
PPT
Jdbc connectivity
PDF
JDBC-Introduction
PPT
Jdbc drivers
PPTX
java Jdbc
PDF
Overview Of JDBC
PPT
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
PPT
Jdbc complete
PPS
Jdbc architecture and driver types ppt
Java database connectivity with MySql
Database and Java Database Connectivity
JDBC Architecture and Drivers
jdbc document
Java- JDBC- Mazenet Solution
Jdbc connectivity in java
Jdbc drivers
Jdbc (database in java)
Java database connectivity
Jdbc connectivity
JDBC-Introduction
Jdbc drivers
java Jdbc
Overview Of JDBC
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
Jdbc complete
Jdbc architecture and driver types ppt
Ad

Similar to creating jdbc connection (20)

PDF
JDBC : Java Database Connectivity
PPT
Jdbc ppt
PPTX
jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
PDF
JDBC with MySQL.pdf
PDF
JDBC with MySQL.pdf
PPTX
Java database connectivity with MySql
PPTX
chapter 5 java.pptx
PPTX
jdbc-130913021409-phpapp01000988www.pptx
PDF
Chapter 5 JDBC.pdf for stufent of computer andtudent It s
PPTX
Java jdbc
PPT
Unit 5-jdbc2
PPTX
Jdbc new
PPTX
Jdbc introduction
PPT
Basic Java Database Connectivity(JDBC)
PDF
JDBC Presentation with JAVA code Examples.pdf
PPT
PDF
PPTX
Rajesh jdbc
PDF
unit8_jdbc.pdf mysql and java jdbc connection
PPTX
Core jdbc basics
JDBC : Java Database Connectivity
Jdbc ppt
jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
JDBC with MySQL.pdf
JDBC with MySQL.pdf
Java database connectivity with MySql
chapter 5 java.pptx
jdbc-130913021409-phpapp01000988www.pptx
Chapter 5 JDBC.pdf for stufent of computer andtudent It s
Java jdbc
Unit 5-jdbc2
Jdbc new
Jdbc introduction
Basic Java Database Connectivity(JDBC)
JDBC Presentation with JAVA code Examples.pdf
Rajesh jdbc
unit8_jdbc.pdf mysql and java jdbc connection
Core jdbc basics
Ad

More from Paneliya Prince (20)

PPTX
140120107044 ins ala.ppt
DOCX
To create a web service
PPT
Session and state management
PPT
Master pages
DOCX
Master page
DOCX
Managing states
PPT
Introduction to ado.net
DOCX
Grid view control
PPTX
Asp.net validation
PPT
Asp.net control
DOC
Wt oep visiting card
DOCX
SE OEP online car service booking
PPTX
creating jdbc connection
PPTX
processing control input
PPT
static dictionary technique
DOCX
Ajava oep
DOC
Ajava oep shopping application
PPT
creating jdbc connection
PPTX
PPTX
static dictionary
140120107044 ins ala.ppt
To create a web service
Session and state management
Master pages
Master page
Managing states
Introduction to ado.net
Grid view control
Asp.net validation
Asp.net control
Wt oep visiting card
SE OEP online car service booking
creating jdbc connection
processing control input
static dictionary technique
Ajava oep
Ajava oep shopping application
creating jdbc connection
static dictionary

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Well-logging-methods_new................
PDF
composite construction of structures.pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
Welding lecture in detail for understanding
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Construction Project Organization Group 2.pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
additive manufacturing of ss316l using mig welding
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
OOP with Java - Java Introduction (Basics)
R24 SURVEYING LAB MANUAL for civil enggi
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Well-logging-methods_new................
composite construction of structures.pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
Lecture Notes Electrical Wiring System Components
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Digital Logic Computer Design lecture notes
Welding lecture in detail for understanding
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Automation-in-Manufacturing-Chapter-Introduction.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Construction Project Organization Group 2.pptx
573137875-Attendance-Management-System-original
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
additive manufacturing of ss316l using mig welding

creating jdbc connection

  • 1. GANDHINGAR INSTITUTE OF TECHNOLOGY INFORMATION TECHNOLOGY DEPARTMENT ADVANCED JAVA CREATING JDBC CONNECTION Enrollment no: 150120116047 Name: Prince Paneliya Guided By: Prof. Prashant Jani
  • 2. What is JDBC? JDBC provides Java applications with access to most database systems via SQl. JDBC acronomy of java database connectivity through Sun Microsystems claims that it is not the full form. JDBC is a standard java API for independence database connection between a java program and wide range of relational database.
  • 3. Database Connectivity Before APIs like JDBC and ODBC, database connectivity was tedious Each database vendor provided a function library for accessing their database The connectivity library was proprietary. If the database vendor changed for the application, the data access portions had to be rewritten
  • 4. Types of JDBC Drivers There are four types of jDBC Drivers. Type 1 - JDBC-ODBC Bridge Type 2 - JDBC-Native Bridge Type 3 - JDBC-Net Bridge Type 4 - Direct JDBC Driver
  • 5. JDBC-ODBC Bridge It runs only on platforms where ODBC is available ODBC must be configured separately The JDBC-ODBC bridge driver uses ODBC driver to connect to the database. The JDBC-ODBC bridge driver converts JDBC method calls into the ODBC function calls. Jdbc api Java application Jdbc- odbc driver Odbc driver DataB ase Vendor databa se
  • 6. JDBC Native Bridge The Native API driver uses the client-side libraries of the database. The driver converts JDBC method calls into native calls of the database API Java application Jdbc api Native Api driver Vendor database DataBase
  • 7. JDBC-Net Bridge  The Network Protocol driver uses middleware that converts JDBC calls directly or indirectly into the vendor- specific database protocol.  It is fully written in java. Java Application Network Protocol layer Middleware Databas e JDBC Api
  • 8. Direct JDBC Driver  The thin driver converts JDBC calls directly into the vendor-specific database protocol.  That is why it is known as thin driver. It is fully written in Java language. Java Application JDBC Api Thin driver Database
  • 9. steps to connect JDBC connection  There are five steps to connect java application with the database in java using JDBC. 1. Register the Driver class. 2. Create the connection object. 3. Create the statement object. 4. Execute the query. 5. Close the connection.
  • 10.  The forName() method of Class class is used to register the driver class.  This method is used to dynamically load the driver. syntax:- Class.forName(“mysql.jdbc.driver. mysqldriver”);
  • 11.  The getConnection() method of DriverManager class is used to establish connection with the database. Syntax :- Connection con = DriverManager.getConnection(“jd bc:mysql://localhost:dbname”,”roo t”,”password”)
  • 12.  The createStatement() method of Connection interface is used to create statement.  The object of statement is responsible to execute queries with the database. Syntax:- Statement stmt=con.createStatement();
  • 13.  The executeQuery() method of Statement interface is used to execute queries to the database.  This method returns the object of ResultSet that can be used to get all the records of a table. Syntax:- ResultSet rs = stmt.ExecuteQuery(“select * from table”); While(rs.next()){ System.out.println(“rs.getInt(1)+“ ”+rs.getString(“name”) ); }
  • 14.  By closing connection object statement and ResultSet will be closed automatically.  The close() method of Connection interface is used to close the connection. Syntax:- con.close();

Editor's Notes

  • #3: JDBC provides Java applications with access to most database systems via SQL