JDBC Tutorial in Java

  • JDBC stands for Java Database Connectivity
  • The JDBC API defines interfaces and classes for writing database applications in Java by making database connections.
  • JDBC Driver is a software component which enables java application to interact with the database.

  • Steps to connect Java Application to Database

  • The following 5 steps are the basic steps involve in connecting a Java application with Database using JDBC.
    • Define the connection URL.
    • Established the connection.
    • Create the Statement object.
    • Execute a query.
    • Process the results.
    • Close the connection.

  • Types of Statement in JDBC

  • There are 3 types of Statements, as given below:
  • Statement:  It can be used for general-purpose access to the database. It is useful when you are using static SQL statements at runtime.
  • PreparedStatement:   It can be used when you plan to use the same SQL statement many times. The PreparedStatement interface accepts input parameters at runtime.
  • CallableStatement:  CallableStatement can be used when you want to access database stored procedures.






javaglobe adsense

javaglobe adsense