JDBC Tutorial

JDBC Tutorials

The Java Database Connectivity (JDBC) API enable Java application to interact with a database. In this tutorials, it provides many step by step examples on using JDBC Statement, PreparedStatement , CallableStatement , JDBC Transaction and how to integrate with other frameworks like Spring.

Happy learning JDBC :)

Quick Start

Some quick guides to show how JDBC interact with databases like MySQL, Oracle and PostgreSQL.

JDBC & Statement

The “Statement” interface is used to execute a simple SQL statement with no parameters. For create, insert, update or delete statement, uses “Statement.executeUpdate(sql)“; select query, uses “Statement.executeQuery(sql)“.

JDBC & PreparedStatement

The “PreparedStatement” interface is extended “Statement”, with extra feature to send a pre-compiled SQL statement with parameters. For create, insert, update or delete statement, uses “PreparedStatement.executeUpdate(sql)“; select query, uses “PreparedStatement.executeQuery(sql)“.

JDBC & Stored Procedure

JDBC CallableStatement and Stored Procedure, IN, OUT, CURSOR examples.

JDBC Transaction example

JDBC Trasaction how to :

JDBC Integration example

Integrate JDBC with other frameworks.

FAQ

Reference

Tags :

About the Author

mkyong
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

  • Pingback: pay per day loans plan()

  • Pingback: water ionizer()

  • Pingback: pay per day loan plans()

  • Pingback: stop parking()

  • Pingback: laan hurtige penge nu()

  • Pingback: fue.mobi()

  • Pingback: car parking()

  • Pingback: stream movies()

  • Pingback: Click here to download()

  • Pingback: Blue Coaster33()

  • Code NIrvana

    Good Projects!
    I am also working on JDBC and posting my programs to make it available for the visitor here : http://www.codenirvana.in/search/label/Java

  • vittal

    hi mkyong, its really awesome, a very good site to learn……
    thnq u….

  • http://android.programmerguru.com/ Android Guru

    You can start learning Android programming from scratch through this blog – http://android.programmerguru.com.
    Blog is targetted for Freshers or novice programmers who want to begin learning Android application development.

  • vishwas

    hi yong

    Can you tell me how to get list of database in Oracle as well as MySql using java?
    Like SQLYog IDE which lists all databases in MySql.
    I want the same thing. I want to connect to any Database server and fetch list of database in it.

  • http://baliona.com panji

    thansk for u share sir,

    nice post

  • venkat

    i want subscription with jdbc code pls help

  • http://edokode.com edo

    Hi Mr mkyong, your post’s very awesome and really helpful

  • Ashabasa

    Hello

    I’m creating a web service on Java. And I need it to connect with many dbms (Oracle, MySql…). Is there a way to do that ?
    PS :I’m working with hibernate.

  • http://www.mkyong.com venkat

    i want all database data retrive in the xml file code

  • http://www.mkyong.com venkat

    i want jdbc with xml programs…..

  • venkat

    where is the search box in this website?

  • venkat

    where is the search box inthis site?

  • srinivasa reddy

    all the tutorials are very helpful for me and all others

    can u upload tutorials for servlets ans jsp

    thank you mr.yong

  • sexy back

    Good article

  • Krishna Kumar

    hi sir,could help me please,actually we are using prepared statement for speed up and much more,ok but i want to perform single operation not bulk,which one is better and fast general or prepared stament(and also in terms of sql injection).thanx a lot sir.

  • http://baliona.com panji

    thanks for u tutorial

    i like this posting

  • Crossroad

    Hi mkyong, very good tutorials! Thaks a lot for making java so simple =)

    Can you make a tutorial about using trigger??

  • masood

    hi sir,

    can u explain me, how can we get database table address in java program., pls help me out sir, this question asked in interview for my friend.

  • saroj

    thnx mr. yong this article of your’s abt JDBC helped me a lot

    • jainath Jaiswal

      thnx mr. yong this article of your’s abt JDBC helped me a lot

  • Saraswati

    Hi Yong,
    can you please suggest a good JSP tutorial?
    thanks.

  • http://www.technoend.com Raj

    nice article…….. keep it up,very helpful.

  • spaceinvader

    an article in JFreeChart and JavaMail :) plz

    • Raj

      Very nice article

  • anonim

    An article about deadlocks would be appreciated.