Java 5TH Chapter - 22517
Java 5TH Chapter - 22517
Java 5TH Chapter - 22517
52 Native – protocol pure Java converts 91 Type II JDBC driver is also known as __
……….. in to the ………… used by DBMSs
directly. Native API partly Java driver
ResultSet
107 Which interface is important from
java.sql package in JDBC?
67 The ...................... method sets the query
parameters of the PreparedStatement Object. Connection
setString()
110 Which is default ResultSet type
register a driver
111 Which is not a type of JDBC driver
121 Which method of class is used to register 155 __________ method of DriverManager
& dynamically load the driver class? class is used to create connection with
database. getConnection()
forName()
283 DatabaseMetaData are retrieved through 334 In DriverManager class which method is
____________. used to establish the connection with the
specified url?
Connection object
public static Connection
getConnection(String url)
287 DriverManager class does not provides
methods for ___________________
354 kind of driver converts JDBC calls on
Executing sql statement and retrieving results client API for Oracle, cybase, Informix, DB2,
or other DBMS is known as__________
318 Identify the correct code to retrive values Precompiled SQL Statement
from database
Statement st=con.createStatement(); 374 PreparedStatement interface
ResultSet rs=st.executeQuery(); extends____________________ interface
Statement
320 Identify wrong type of ResultSet
ResultSet.TYPE_BACKWORD_ONLY 375 PreparedStatement object in JDBC is
used to execute
____________________quiries
322 If ___________is set to true,then a
commit is implicitly applied after the Parameterized
execution of every SQL statement.
AutoCommit
AJP – 22517
CHAPTER 5 ~ INTERACTING WITH DATABASE
377 PrepareStatement() method is of 449 What does the following code do?
____________________ interface smt=con.createStatement();
Connection A Statement object is created to send sql
commands to the database
488 What MySQL property is used to create 537 Which JDBC driver Type(s) can you use
a surrogate key in MySQL? in a three-tier architecture and if the Web
server and the DBMS are running on the
AUTO_INCREMENT same machine?
All of Type 1, Type 2, Type 3 and Type 4
512 When the message "No suitable drivers
found" is displayed?
538 Which JDBC driver Type(s) is (are) the
if JDBC database URL passed is not JDBC-ODBC bridge?
constructed properly.
Type-1
555 Which of the following invokes stored 599 ____type of driver is very flexible and
procedures in sql? need not code installation on the client
machine
callable statements
Type 3-JDBC-Net Pure java
• ODBC stands for Open Database Connectivity. It is basically API i.e. Application
Programming Interface.
• Import.java.sql.* package is used.
• JDBC stands for Java DataBase Connectivity. JDBC is nothing but an API (i.e.
Application Programming Interface).
• JDBC Architecture
- Two tier : Java application can directly communicate with database using JDBC
driver API.
- Three tier: HTML browser will send command to java application to communicate
with database using JDBC driver API.
AJP – 22517
CHAPTER 5 ~ INTERACTING WITH DATABASE
• JDBC DRIVERS:
1) Types 1: JDBC – ODBC Bridge, it can have access to any database possible
3) Type 3: All JAVA/ Net Protocol driver for accessing middleware server.
- all the JDBC calls are passed through the network to the middle-ware server
- This is also known as as JDBC net - pure Java driver.
• Driver Interface.
- The JDBC API is a set of classes, interfaces and exceptions used for establishing
connection with data source.
- This JDBC API is defined in the java.sql and javax.sql packages.
- It Contains following classes.
2) Connection Interface
- This interface connects to the data source, creating a Statement instance.
- To connect, use DriverManager.getConnection() method from JDBC, and write a
statement in Java.
AJP – 22517
CHAPTER 5 ~ INTERACTING WITH DATABASE
3) Statement Interface
- It is used to execute static SQL statements.
- It cannot accept Parameters.
4) Resultset Interface
- It is used to access database tables.
- The rows are retrieved using resultSet object.
- It maintains a cursor to the current row of data. Initially it is positioned before the
first row.
- The ResultSet object can be created using executeQuery() method.
- Navigating methods
AJP – 22517
CHAPTER 5 ~ INTERACTING WITH DATABASE
- Methods for reading results using Resultset.