• TestingDocs
TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

JDBC

JDBC API Components

Overview

Let’s learn JDBC API Components in this tutorial. JDBC API is a collection of classes and interfaces that provide database access. Using the JDBC API, we can access any database. The core JDBC API is comprised of two main packages. We automatically get both packages when we download Java on the machine. The two packages are as follows:

  • java.sql;
  • javax.sql;

 

 

JDBC API TestingDocs

JDBC Components

The main JDBC API Components are as follows:

  • JDBC Driver
  • DriverManager
  • Connection
  • Statement
  • ResultSet
  • ResultSet Metadata

JDBC Driver

A JDBC driver is a software component that provides the implementation of the JDBC API for a specific database system. For example, MySQL JDBC driver for Java programming language is: MySQL Connector/J

MySQL Connector/J is the official JDBC driver for the MySQL database. It allows Java applications to connect to and interact with the MySQL database. In general, there are different types of JDBC drivers available.

  • Type 1 (JDBC-ODBC Bridge)
  • Type 2 (Native API)
  • Type 3 (Network Protocol)
  • Type 4 (Thin Driver or Pure Java Driver)

DriverManager

DriverManger manages the JDBC drivers and establishes the connection to the database. It uses the JDBC URL to establish the connection to the database. It returns the Connection object on a successful database connection.

Connection

The Connection object represents the session to the connected database. The createStatement() method creates a Statement object to send SQL statements to the database.

Statement

The Statement object is used for executing the SQL statements and returns the SQL query results.

Example: stmt.executeQuery(sqlQuery)

ResultSet

The ResultSet object refers to the SQL query result table. The ResultSet object maintains a cursor pointing to the current row of the query result table. We can use a while loop to iterate through the ResultSet.

—

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

More information about Oracle Database:

https://www.oracle.com/database/

Related Posts

tnsnames File Oracle TestingDocs

JDBC /

Connect to Oracle Database using JDBC Thin Driver

Display Oracle Database Table JDBC

JDBC /

Display data from Oracle Database table using JDBC

JDBC /

JDBC ResultSet Interface

Configure Build Path Eclipse

JDBC /

Configure JDBC Driver in Java Project

JDBC DriverManager Class

JDBC /

JDBC DriverManager Class

‹ JDBC ResultSet Interface› Display data from Oracle Database table using JDBC

Recent Posts

  • How to secure your SQL Database: Tips and Tricks
  • Shaping the Future of Development: Exploring Key Trends in Software Engineering
  • Improving Java Performance with Multithreading
  • Difference between PHP and JavaScript?
  • Bing Conversation Styles
  • ChatGPT Introduction
  • Open Source AI Frameworks
  • Artificial Intelligence Tools
  • Top AI Music Applications
  • Top AI Website Design Tools

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com