javapandit.net
  • Home
  • Quick Java
    • Exception Handling
    • Collections Framework
  • Java Best Practices
  • Web Services
    • Web Service Basics
    • Ten Basic webservice concepts
    • XML
    • Apache Axis
    • Restful Web Services
  • JMS Concepts
    • JMS- MySQL
  • Hadoop
    • NoSQL DATABASEs
    • Apache Sqoop
    • Hadoop Interview Questions
  • Java 5
  • Java 8
    • Java 8 : Lambda Expressions
  • JDBC
  • Java Architect
    • Enterprise application re-platforming strategies
    • Java Memory Management
  • Java Programs
  • Technical Tips
    • How to set JAVA_HOME environment variable
    • How to create an auto increment field in Oracle?
    • Linux Commands
  • Best Java Interview Questions
    • Java Interview Questions- YouTube
  • Interview Questions
    • Java Tech interview Questions
    • Core Java Interview Questions >
      • core tech questions1
      • Java Collection interview questions
      • Java Concurrency
    • Servlets Interview Questions
    • JSP Interview Questions
    • Java Web Services Interview Questions
    • EJB Interview Questions
    • XML Interview Questions
    • JMS Interview Questions
  • Struts Interview Questions
    • Struts 2 Interview Questions
  • Java EE Architects Interview Questions
    • Java Architect Interview Questions
    • Top 10 reasons for Java Enterprise Application Performance Problems
    • Web Application Scalability Questions for IT Architect
  • JavaPandit's Blog
  • Web Services Interview Questions
  • Servlets And JSP
  • Oracle SOA Interview Questions
    • Open ESB /JBI
    • BPEL Language
  • Log4J
  • Ant
  • Maven
  • JMeter
  • JUnit
  • Apache POI Framework
  • ORCALE SERVICE BUS (OSB) Interview Questions
  • J2EE Patterns
    • Model-View-Controller (MVC)
    • Front Controller
    • DAO
    • Business Delegate
    • Session Facade
    • Service Locator
    • Transfer Object
    • Design Patterns >
      • Creational Patterns >
        • Singleton
      • Behavioural Patterns
      • Structural Patterns
    • Intercepting Filter
  • SQL Interview Questions/Lab
  • Best Wall Papers
    • Devotional Songs
  • Java Community
  • HIBERNATE
  • ORACLE CC&B
    • Oracle CC&B Interview Questions
  • Docker
  • Little Princess
    • Sai Tanvi Naming Ceremony Celebrations
    • Rice Feeding Ceremony
    • Sai Tanvi Gallery
  • APPSC Career Guidance
    • AP History
    • Indian Polity
    • Indian Economy
    • Science & Technology
    • Mental Ability and Reasoning
    • Disaster Management
    • Current Affairs and Events
    • General Sciences >
      • Biology
      • Physics
      • Chemistry
    • Previous Question Papers
  • About Us
  • Contact US

_Java DataBase Connectivity (JDBC)



JDBC stands for Java Database Connectivity, which is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.

The JDBC library includes APIs for each of the tasks commonly associated with database usage:
  • Making a connection to a database
  • Creating SQL statements
  • Executing that SQL queries in the database
  • Viewing & Modifying the resulting records
JDBC was designed specifically to provide a Java interface to relational databases, you may find that you need to write Java code to access non-relational databases as well.

JDBC Architecture:

Picture

Java application calls the JDBC library. JDBC loads a driver which talks to the database. We can change database engines without changing database code.
JDBC mainly contains two things.

  • JDBC API
  • JDBC Driver

JDBC Drivers:
A database API, or driver, defines methods and properties that enable you to send, retrieve, and obtain status information about the database as well as extract data. You can obtain database drivers from a variety of sources.

JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server. For example, using JDBC drivers enable you to open data base connections and to interact with it by sending SQL or database commands then receiving results with Java.

JDBC driver types:
JDBC driver implementations vary because of the wide variety of operating systems and hardware platforms in which Java operates. Thus, Sun has divided the implementation types into four categories, Types 1, 2, 3, and 4, whose characteristics vary greatly.
Type-1 Driver: JDBC-ODBC Bridge:-
This category works with ODBC drivers supplied by your database vendor or a third party. Although you may find ODBC implementations for UNIX, they are usually used with Microsoft Windows. To use the bridge, you must first have an ODBC driver specifically for your database and any additional software that you need for connectivity. Figure shows how a client interacts with the database using the JDBC−ODBC bridge.
Type 2: JDBC−native API
This category requires an operating system–specific API that handles the database communications. Usually the vendor implements the API using C/C++ so it will be optimized for the client’s environment. As a developer, you do not have to worry about the details of the native API, a Type 2 driver handles the interaction. Figure illustrates a Type 2 JDBC driver configuration.
Type 3: 100% Pure Java, JDBC−network
Type 3 drivers use a three−tier approach to accessing databases. J2EE deployments often implement this architecture. Clients use standard network sockets to communicate with an application server. The socket information is then translated by the application server into the call format required by the DBMS, and forwarded to the database server. Figure 4−5 shows a typical three−tier configuration that uses a Type 3 driver for database connectivity.
Type 4: 100% Java
Type 3 drivers use a three−tier approach to accessing databases. J2EE deployments often implement this architecture. Clients use standard network sockets to communicate with an application server. The socket information is then translated by the application server into the call format required by the DBMS, and forwarded to the database server. Figure 4−5 shows a typical three−tier configuration that uses a Type 3 driver for database connectivity.
Each type of driver has its benefits and weaknesses. Your job as a developer is to understand them so you can make good design decisions.


Prev 1 2 3 4 Next
Powered by Create your own unique website with customizable templates.