JDBC
Which type of JDBC driver is the fastest one?
Dec 2nd
JDBC Net pure Java driver(Type IV) is the fastest driver because it converts the JDBC calls into vendor specific protocol calls and it directly interacts with the database.
How the JDBC application works?
Dec 2nd
A JDBC application can be logically divided into two layers:
1. Driver layer
2. Application layer
- Driver layer consists of DriverManager class and the available JDBC drivers.
- The application begins with requesting the DriverManager for the connection.
- An appropriate driver is choosen and is used for establishing the connection. This connection is given to the application which falls under the application layer.
- The application uses this connection to create Statement kind of objects, through which SQL commands are sent to backend and obtain the results.
Exaplain the JDBC Architecture.
Dec 2nd
The JDBC Architecture consists of two layers:
- The JDBC API, which provides the application-to-JDBC Manager connection.
- The JDBC Driver API, which supports the JDBC Manager-to-Driver Connection.
The JDBC API uses a driver manager and database-specific drivers to provide transparent connectivity to heterogeneous databases. The JDBC driver manager ensures that the correct driver is used to access each data source. The driver manager is capable of supporting multiple concurrent drivers connected to multiple heterogeneous databases. The location of the driver manager with to the JDBC drivers and the Java application is shown in Figure .
How do I load a database driver with JDBC 4.0 / Java 6?
Dec 1st
Provided the JAR file containing the driver is properly configured, just place the JAR file in the classpath. Java developers NO longer need to explicitly load JDBC drivers using code like Class.forName() to register a JDBC driver.The DriverManager class takes care of this by automatically locating a suitable driver when the DriverManager.getConnection() method is called. This feature is backward-compatible, so no changes are needed to the existing JDBC code.
What are the advantages of DataSource?
Dec 1st
The few advantages of data source are :
- An application does not need to hardcode driver information, as it does with the
DriverManager. - The
DataSourceimplementations can easily change the properties of data sources. For example: There is no need to modify the application code when making changes to the database details.
The DataSource facility allows developers to implement a DataSource class to take advantage of features like connection pooling and distributed transactions
Exaplain the JDBC Architecture.
Nov 26th
The JDBC Architecture consists of two layers: • The JDBC API, which provides the application-to-JDBC Manager connection. • The JDBC Driver API, which supports the JDBC Manager-to-Driver Connection. The JDBC API uses a driver manager and database-specific drivers to provide transparent connectivity to heterogeneous databases. The JDBC driver manager ensures that the correct driver is used to access each data source. The driver manager is capable of supporting multiple concurrent drivers connected to multiple heterogeneous databases. The location of the driver manager with respect to the JDBC drivers and the Java application is shown in Figure 1.
What are the main components of JDBC ?
Nov 26th
The life cycle of a servlet consists of the following phases: • DriverManager: Manages a list of database drivers. Matches connection requests from the java application with the proper database driver using communication subprotocol. The first driver that recognizes a certain subprotocol under JDBC will be used to establish a database Connection.
• Driver: The database communications link, handling all communication with the database. Normally, once the driver is loaded, the developer need not call it explicitly.
• Connection : Interface with all methods for contacting a database.The connection object represents communication context, i.e., all communication with database is through connection object More >
How the JDBC application works?
Nov 26th
A JDBC application can be logically divided into two layers: 1. Driver layer 2. Application layer • Driver layer consists of DriverManager class and the available JDBC drivers. • The application begins with requesting the DriverManager for the connection. • An appropriate driver is choosen and is used for establishing the connection. This connection is given to the application which falls under the application layer. • The application uses this connection to create Statement kind of objects, through which SQL commands are sent to backend and obtain the results.
Explain Basic Steps in writing a Java program using JDBC?
Nov 26th
JDBC makes the interaction with RDBMS simple and intuitive. When a Java application needs to access database : • Load the RDBMS specific JDBC driver because this driver actually communicates with the database (Incase of JDBC 4.0 this is automatically loaded). • Open the connection to database which is then used to send SQL statements and get results back. • Create JDBC Statement object. This object contains SQL query. • Execute statement which returns resultset(s). ResultSet contains the tuples of database table as a result of SQL query. • Process the result set. • Close the connection.
What is the JDBC?
Nov 26th
Java Database Connectivity (JDBC) is a standard Java API to interact with relational databases form Java. JDBC has set of classes and interfaces which can use from Java application and talk to database without learning RDBMS details and using Database Specific JDBC Drivers.
