
- Java Database Connectivity (JDBC)
- RDBMS understand SQL language only.
- JDBC driver converts Java requests in database understandable form and database response in Java
understandable form.
- JDBC drivers are of 4 types
Type I - Jdbc Odbc Bridge driver
- ODBC is standard of connecting to RDBMS (by Microsoft).
- Needs to create a DSN (data source name) from the control panel.
- From Java application JDBC Type I driver can communicate with that ODBC driver (DSN).
- The driver class: sun.jdbc.odbc.JdbcOdbcDriver -- built-in in Java.
- database url: jdbc:odbc:dsn
- Advantages:
- Can be easily connected to any database.
- Disadvantages:
- Slower execution (Multiple layers).
- The ODBC driver needs to be installed on the client machine.
Type II - Partial Java/Native driver
- Partially implemented in Java and partially in C/C++. Java code calls C/C++ methods via
JNI.
- Different driver for different RDBMS. Example: Oracle OCI driver.
- Advantages:
- Disadvantages:
- Partially in Java (not truely portable)
- Different driver for Different RDBMS
Type III - Middleware/Network driver
- Driver communicate with a middleware that in turn talks to RDBMS.