JDBC Driver Types & Architecture
A JDBC driver is a set of Java classes that implement the JDBC interfaces, looking for a specific database. The JDBC interfaces come with standard Java, but the implementation of these interfaces is specific to the database to which you have to connect. This implementation is called the JDBC driver.
The Data Access Handbook explains two main reasons why a database driver can degrade performance.
- The controller architecture is not ideal.
- The controller is not adjustable. You do not have runtime performance tuning options that allow you to configure the driver for optimal performance. The type of options we are talking about are the ones that you can adjust to match your application and the environment. For example, if the application retrieves large objects, look for a driver option that allows you to configure the amount of active memory that the controller uses to cache a large object.
This post details the different architectures of the database controller.
There are four different architectures for the database drivers: bridge, client-based, database cable protocol and independent protocol. Choose a database driver that is implemented with an architecture that offers the best performance for your application.
Type 1 – Bridge Architecture
A bridge is a database driver that bridges an existing and new database connectivity pattern as shown in the figure. For example, when Sun Microsystems, Inc. released the JDBC specification, Sun wanted to animate developers to use JDBC, but not many JDBC drivers were on the market at that time. However, hundreds of ODBC drivers for almost all data sources were available, so Sun Microsystems, Inc. released a single JDBC / ODBC bridge that gave Java developers access to all data sources supported by ODBC drivers.
An implementation of the JDBC API translated the received JDBC calls to the appropriate ODBC calls using the JNI (Java Native Interface). The requests are sent to the underlying ODBC driver (which at that time was just a shell over the native client libraries of the database). The bridge implementation was sent with JDK so that it only needed the ODBC drivers and the native DB client libraries to start. Unless another solution meets the requirements of the database application, consider using a database driver with a more optimized architecture.
The following are the disadvantages of using bridges:
- Often, they can not fully implement a new standard because they are limited by the definition of the alternative pattern.
- They can represent security risks.
- Many implementations strive to function ideally under high user accounts.
Type 2 – Client Based Architecture
This architecture eliminated the need for the ODBC driver and, instead, directly called the native client libraries provided by the database providers.
The database drivers based on the client communicate with the database through the client software of the database, as shown in the figure. This software is the proprietary software of the database provider, such as Oracle Net8 or OpenClient for Sybase
The following are the disadvantages of using client-based drivers:
- You must install, configure and maintain the database client software on all computers that need connectivity to the database.
- You may have to install and support a different version of the client software for each version of the database system you are using.
- The database controller must be developed with the restrictions of the client software, which may be functional or quality restrictions. For example, if your application is designed to run on a 64-bit Linux operating system, but the database provider does not offer its database client software in the operating system, the database driver provider does not You can develop a 64-bit 64-bit driver.
The Oracle JDBC OCI drivers are type 2 drivers that use native Java methods to call the C input points of the OCI library.
Type 3 – Two Tier Architecture
The type 3 controllers had a Java client component and a Java server component, where the latter really talked to the database.
The database controller converts standards-based API calls into a separate database protocol, which is translated to the database connection protocol through a server. This architecture has a database driver client and a server component, as shown in the figure.
Typically, this type of architecture provides advanced security features, such as the latest SSL encryption, access to a more varied set of data sources, such as SQL for VSAM files, and centralized management and monitoring.
A major disadvantage exists for this type of controller: a client and a server component must be installed, configured and maintained.
Type 4 – Database Wire Protocol Architecture
The database protocol controllers communicate directly with the database, eliminating the need for the client software from the database, as shown in the figure.
The databases have a proprietary API that allows other software components to communicate with them. In a client-based architecture, the client software makes the connection protocol calls to the database. In a database connection protocol architecture, the database controllers generate the necessary connection protocol calls, thus communicating directly with the database.
Interested in learning Java? Enroll now:” Java training in Chennai “
The benefits of choosing a database driver that has a database connection protocol architecture are many.
- The database driver can be installed with your database application and can be immediately connected to the database without configuring other software.
- It is not necessary to install, configure and maintain the database client software.
- Performance is improved because a database connection protocol driver does the following:
- It decreases the latency by eliminating the necessary processing in the client software and the additional network traffic caused by the client software.
- Reduces network bandwidth requirements for additional transmissions. That is, database protocol controllers can optimize network traffic because they can control the interaction with TCP.
- Regarding Java and ADO.NET, there is another important advantage when using a controller / protocol provider to connect to the database: The controller / provider does not have to make calls to the client software. For Java, this means that the controller can use pure Java code and not make calls to native libraries. The pure Java standard is a set of programs, rules and certifications used in the design process to ensure that Java executables are in accordance with the principles of WORA (write once, always execute). A pure Java program depends only on the specifications of the Java language. Using native methods in a Java program means that you lose the benefits of Java Runtime, such as security, platform independence, garbage collection and easy class loading. The specific external functionality is provided by the main Java APIs, such as JDBC.It connects directly to Oracle through Java sockets without the need for a JDBC-specific middle layer. The Thin JDBC driver can only connect to a database if a TNS detector is active and listening for TCP / IP sockets.
To getting expert-level training for Java Training in your location – java training in Chennai | java training in Bangalore | java training in Pune | java training in Chennai | java training in Bangalore | java training in Chennai | java interview questions and answers | core java interview questions and answers | java training in Chennai | For getting java online training | java online training