Spring JBDC Interview Questions and Answers - 2
Question: 6
How many JDBC Drivers are there?
There are four types of JDBC drivers.
JDBC – ODBC Bridge Driver (Type – 1 driver)
Native API Partly Java Driver (Type – 2 driver)
Net Protocol Pure Java Driver (Type – 3 driver)
Native Protocol Pure Java Driver (Type – 4 driver)
Question: 7
What is the difference between JDBC and ODBC?
ODBC is for Microsoft and JDBC is for Java applications.
ODBC can’t be directly used with Java because it uses a C interface.
ODBC makes use of pointers which have been removed totally from Java.
ODBC mixes simple and advanced features together and has complex options for simple queries. But JDBC is designed to keep things simple while allowing advanced capabilities when required.
ODBC requires manual installation of the ODBC driver manager and driver on all client machines. JDBC drivers are written in Java and JDBC code is automatically installable, secure, and portable on all platforms.
JDBC API is a natural Java interface and is built on ODBC. JDBC retains some of the basic features of ODBC.
Question: 8
What are the different types of exceptions in JDBC?
batchUpdate Exception
Data Truncation
SQL Exception
SQL Warning
Question: 9
What are the steps for connecting to the database using JDBC?
Using DriverManager:
Load the driver class using class.forName(driverclass) and Class.forName() loads the driver class and passes the control to DriverManager class.
DriverManager.getConnection() creates the connection to the database.
Using DataSource:
DataSource is used instead of DriverManager in Distributed Environment with the help of JNDI.
Use JNDI to lookup the DataSource from Naming service server.
DataSource.getConnection method will return Connection object to the database.
Question: 10
What are the steps involved in establishing a connection?
This involves two steps:
loading the drivers and
making the connection
Signals and Systems MCQ Questions and Answers Pdf More
Electrical Power Sources Quiz Questions & Answers Pdf More
Electromagnetic Field Theory Question Bank 2024-2025 More
Power Semiconductor Device and Integrated Circuits Questions More
Strength of Materials Questions and Answers Pdf More
7000+ Question Tags Exercises with Answers Pdf More
Most Important Prepositions for Competitive Exams Pdf More
Oracle 11g - 12c Sql Loader Interview Questions and Answers Pdf More
TNPSC Atomic and Nuclear Physics Objective Questions & Answers More
Top 1000+ Computer Knowledge Quiz for Competitive Exams More