Java JDBC Tutorials

  • 16 August 2019
  • ADM



Java JDBC Tutorials - images/logos/jdbc.jpg


Java Database Connectivity (JDBC) is an application programming interface (API) for the programming language Java, which defines how a client may access a database. It is part of the Java Standard Edition platform, from Oracle Corporation. JDBC standardises how to connect to a database, how to execute queries, how to navigate the result on a query, and how to execute updates in the database.

Because the JDBC only defines the standard how to operate a database from Java, each database engine will provide a connector that implements that standard.


Before starting with MySQL you need to download MySQL Connector from the download page and attach to your project or if you are using Maven structure you need to add it as a dependency.



For Oracle, you need to downloadits own driver and attach it to your project. For Maven users, add this dependency.



For Microsoft SQL Server you need this driver. For Maven users, you need to add it manually to the maven local repository and then to add it as a dependency.

To do this follow these steps:

  1. Download the driver.
  2. unzip all files to alocal directory.
  3. Go to command prompt navigate to folder where sqljdbc4.jar is located and execute thefollowing command:
    mvn install:install-file -Dfile=sqljdbc4.jar -DartifactId=sqljdbc4 -Dversion=6.0.7130.100 -Dpackaging=jar

    If you need more info on how to add libraries to local maven repository followHow to include library into maven local repositorytutorial.

  4. Now you are able to add it as dependency on your pom.xml file:


Download the driver and attach it to the project, or for Maven users add the dependency.



MySQL JDBC Statement and PreparedStatement

MySQL Stored Procedure

MSSQL JDBC Statement and PreparedStatement

MSSQL Stored Procedure

Oracle JDBC Statement and PreparedStatement

Oracle Stored Procedure

PostgreSQL JDBC Statement and PreparedStatement

PostgreSQL Stored Procedure