Presentation is loading. Please wait.

Presentation is loading. Please wait.

JDBC. SQL(Structured Query Language) is divided into 1.DDL(Data Definition Language) create db, create table, alter table, drop db or table 2.DML(Data.

Similar presentations


Presentation on theme: "JDBC. SQL(Structured Query Language) is divided into 1.DDL(Data Definition Language) create db, create table, alter table, drop db or table 2.DML(Data."— Presentation transcript:

1 JDBC

2 SQL(Structured Query Language) is divided into 1.DDL(Data Definition Language) create db, create table, alter table, drop db or table 2.DML(Data manipulation Language) insert, select, update, delete, truncate 3.TCL(Transaction Control Language) commit, rollback 4.DCL(Data Control Language) grant, revoke

3 Column Constraints Below are column constraints which can be specified while creating or altering table 1.NOT NULL – NULL Values not allowed 2.DEFAULT – default value is used, if no value is specified in insert stmt 3.PRIMARY KEY – ensures all values are different in a column 4.AUTO_INCREMENT – Automatically increments a column value, when new record is inserted

4 Java Application JDBC Driver Database Server Java Database Connectivity

5 JDBC(Java Database Connectivity) JDBC Acts as an interface between Java Application and Database. Package used for Java Applications to interact with database is java.sql

6 Java.sql package

7 You are also using the ojdb14.jar from Oracle, probably with a "thin" jdbc configuration, which means you are using a type-4 driver configuration. With such a configuration, you will only need to deploy the JDBC jar file with your database accessing program. The other options include a JDBC bridge, which really means an ODBC connection wrapped in JDBC clothing. This means you would have to configure your system for correct ODBC function, and then use a JAR file to access ODBC. Due to the extra "hop" of data through ODBC, one would expect it to be a bit slower than a type-4 access; however, there is a possibility that the ODBC is optimized to such a great extent for a particular situation, that the extra hop is negligible. As with most performance concerns, the truth is discovered by testing (in your environment). The type-2 drivers again use a Java (JDBC) API; however, they bridge the calls into a C or C++ style shared library, which then handles the real connection. If the driver is optimized to be so fast that the JNI setup / tear down calls are negligible in cost, then perhaps it might outperform type-4 drivers. Type 3 drivers basically proxy (or relay) the request to another network resource. That typically incurs an extra network hit, but again, that doesn't say much about actual performance. Type 4 drivers are the ones you probably want to stick with. The Java program connects directly to the database, meaning that if there is a problem, it will be captured entirely within the JVM of the program making the connection (type 1, it's in the ODBC layer, type 2 it's in the native compiled code, type 3 it's in the remote network proxy).

8 Type 1: JDBC-ODBC Bridge driver (Bridge) Type 2: Native-API/partly Java driver (Native) Type 3: AllJava/Net-protocol driver (Middleware) Type 4: All Java/Native-protocol driver (Pure) Currently Type4 driver is used Differs in Performances and portability

9 Type 1 Type 2 Type 3 Type 4

10 Difference between different types of JDBC driver comes from the fact how they work, which is basically driven by two factor, portability and performance. Type 1 JDBC driver is the poorest in terms of portability and performance, while type 4 JDBC driver is highly portable and gives best performance.


Download ppt "JDBC. SQL(Structured Query Language) is divided into 1.DDL(Data Definition Language) create db, create table, alter table, drop db or table 2.DML(Data."

Similar presentations


Ads by Google