The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
Rajesh jdbc
1.
2. JDBC – provides an interface to
Relational Data Sources.
JDBC library provides the means for
executing SQL statements to access and
operate on a relational database.
JDBC library is implemented in the
java.sql package
Set of classes and interfaces that
provide a uniform API for access to
broad range of databases.
3. JDBC:
establishes a
connection with a
database
sends SQL statements .
processes the results.
5. JDBC’s DEsIGn Is vEry sImIlar to tHE
design of ODBC.
Driver Manager
Loads database drivers, and
manages the connection between
the application and the driver.
Driver
Translates API calls into
operations for a specific data
source
6. Statement
An SQL Statement to perform a
query or update operation.
Metadata
Information about returned
data, the database and the driver.
ResultSet
Logical set of columns and rows
returned by executing an SQL
statement (resulting tuples).
8. Java Application
talks directly to
the database.
Accomplished
through the JDBC
driver which
sends commands
directly to the
database.
Results sent back
directly to the
application.
A JDBC driver sits
on the client
Application Space
Java Application
JDBC Driver
Database
SQL
Command
Result
Set
9. JDBC driver sends
commands to a middle
tier, which in turn
sends commands to
database.
middle tier can
provide
• a higher-level
API, not just SQL
• control over
database access
• performance
advantages
ex. load
balancing and
caching
frequently accessed
data
Application Space
Java Application
JDBC Driver
Database
SQL
Command
Result
Set
Application Server
(middle-tier)
Proprietary
Protocol
10. Application Space
Java Application
JDBC Driver
Database
SQL
Command
Result
Set
Application Server
(middle-tier)
Proprietary
Protocol
Pros:
flexible: can change one
part without
affecting others
can connect to different
databases without
changing code
specialization:
presentation / business
logic /
data management
can cache queries
can implement proxies
and firewalls
Cons:
higher complexity
higher maintenance
lower network
efficiency
11. JDBC API, a purely
java-based API.
JDBC Driver Manager
which communicates
with vendor specific
drivers that perform
real communication
with the database.
Java Application
JDBC Driver Manager
JDBC/ODBC
Bridge
Vendor
Supplied
JDBC
Driver
ODBC
Driver
12. JDBC-ODBC bridge
plus ODBC driver
basically converts
JDBC calls to
mICrosoFt’s opEn
database
connectivity(ODBC).
As with JDBC , ODBC
programming
interface that you
can use to access
Application Space
Java Application
JDBC – ODBC Bridge
Database
SQL
Command
Result
Set
ODBC Driver
Proprietary
Protocol
13. Advantages:
• Can be useful for databases
where other methods not
available (e.g., MSAccess).
Disadvantages:
• Client computer needs to be
configured with ODBC driver and
ODBC instance which specifies
database server and other
14. SQL Type Java Type
CHAR String
VARCHAR String
LONGVARCHAR String
NUMERIC
java.Math.BigDecimal
DECIMAL
java.Math.BigDecimal
BIT boolean
TINYINT int
SMALLINT int
INTEGER int
BIGINT long
REAL float
FLOAT double
DOUBLE double
BINARY byte[]
VARBINARY byte[]
DATE java.sql.Date
15. 1. Importing Packages .
2. Registering the JDBC Drivers .
3. Opening a Connection to a
Database .
4. Creating a Statement Object.
5. Executing a Query and
Returning a Result Set Object .
6. Processing the Result Set .
7. Closing the Result Set and
Statement Objects .
17. class jdbc_smvdu {
public static void main (String args [])
throws SQLException {
// Load Odbc driver
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
18. //Prompt user for username and password
String user;
String password;
user = readEntry
("username: ");
password = readEntry
("password: ");
// Connect to the local database
Connection conn =
DriverManager.getConnection