JDBC Tutorial

In this tutorial, you learn how to connect to a MySQL database using Java JDBC.

The tutorial starts with an overview of the JDBC API. Then you learn how to set up your development environment with the appropriate MySQL database drivers. Next the tutorial shows you how to submit a SQL query and process the result set. Also, you learn how to perform SQL insert, updates and deletes.

The tutorial moves on to advanced topics such as Prepared Statements to handle SQL paramaters. You also learn how to call stored procedures using various parameter types (IN, INOUT, OUT and ResultSet). Next, the tutorial shows you how to process large data types such as BLOBs and CLOBs. Finally, the tutorial wraps up with a section on reading database connection information from a configuration file.


Did you like my blog post?

Signup now and receive an email when I publish new luv2code content.

I agree to have my personal information transfered to AWeber ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.


  1. Comments  andrew   |  Monday, 02 November 2015 at 9:52 am


    Im having some trouble with my Jtable displaying the data i pull from mysql. i tried to break the problem down. I can get the data (i call students) to print to the console but when i try to implement a version of the table model inside a scrollpane (like yours) i can seem to get anything to show in my jpanel. Would you know how to help me?


  2. Comments  Chad Darby   |  Thursday, 05 November 2015 at 8:00 am

    Hi Andrew,

    I’d recommend that you download the code from the video series and get it running on your local computer.

    Once you’re successful with that, then you should compare your own personal code with the code from the video.

    Let me know if you need anything else πŸ™‚

  3. Comments  gito sukoco   |  Saturday, 02 April 2016 at 7:55 pm

    thanks very much… ilove this website

  4. Comments  Mark   |  Friday, 22 April 2016 at 5:45 pm

    Hi Chad,

    Just a word of gratitude for a wonderfully explained and designed course. I have just finished my degree and I learnt more from this course than my previous year in class learning Java & database implementation. Using your initial design and expanding on the functionality somewhat I was able to create a system I was very proud of, and truth be told would not have been possible without your code and tutorial guidance.

    Many Thanks.

  5. Comments  Denis   |  Sunday, 24 April 2016 at 4:01 am

    Thanks a lot Chad Darby for this excellent jbdc course! From this year and from this site I luv2code much more

  6. Comments  Chad Darby   |  Monday, 02 May 2016 at 9:01 am

    Hi Mark,

    I’m very happy that you found the JDBC course useful. Thanks for the compliments and taking the time to leave such kind words πŸ™‚

  7. Comments  Chad Darby   |  Monday, 02 May 2016 at 9:02 am

    Hi Denis,

    Thanks a bunch for watching the JDBC videos. I’m glad you enjoyed them. Thanks for the positive review πŸ™‚

  8. Comments  Chad Darby   |  Monday, 02 May 2016 at 9:03 am

    you are welcome! thanks for watching the videos πŸ™‚

  9. Comments  Bilguun   |  Tuesday, 03 May 2016 at 11:51 am

    Sorry my english bad but i very well understand this course .Thank you very much this JDBC course very nice tutorials
    Good luck (y) :))

  10. Comments  Chad Darby   |  Tuesday, 03 May 2016 at 9:41 pm

    awesome! so glad you enjoyed the course. thanks for watching πŸ™‚

  11. Comments  Anurag   |  Tuesday, 21 June 2016 at 2:49 pm

    Hi Chad Darby,

    i just start leaning java,so plz give me suggestions.

  12. Comments  Chad Darby   |  Friday, 01 July 2016 at 6:45 pm

    Hi Anurag,

    I have links to help you learn Java: http://www.luv2code.com/learnjava

  13. Comments  Subhadeep Niogi   |  Wednesday, 10 August 2016 at 4:38 pm

    Absolutely wonderful tutorials and great explanation. I am a newbie in Java and this website helped me a lot to get started with Eclipse, Java and the concept of Hibernate.

  14. Comments  Habib Al-Muhanna   |  Tuesday, 06 December 2016 at 1:15 pm

    Hi Chad,

    Thank you.

    Habib Adnan Al-muhanna.
    Baghdad – Iraq

  15. Comments  Chad Darby   |  Friday, 16 December 2016 at 10:39 am

    You are welcome, Habib πŸ™‚

  16. Comments  Vic Calag   |  Wednesday, 05 April 2017 at 6:31 pm

    Hello Chad,

    Greetings from Philippines!

    Thank you very much for this wonderful tutorial and for making it free to the public.

    Best regards,


  17. Comments  Chad Darby   |  Thursday, 06 April 2017 at 5:44 pm

    Hi Vic,

    Thanks so much for the kind words! thanks for watching my videos πŸ™‚

  18. Comments  shiva   |  Sunday, 28 May 2017 at 2:23 pm

    i want to import file to database which was shown in vedio 5 (prepared statements).

    am confusing. how to import files to mysql database.
    i want to know step by step.

  19. Comments  Chad Darby   |  Sunday, 28 May 2017 at 2:37 pm

    I have another video that shows how to insert into a database

    Java JDBC Tutorial – Part 10: BLOB – Reading and Writing BLOB with MySQL

  20. Comments  StudentofJava   |  Thursday, 17 January 2019 at 2:56 pm

    I want to thank you, those videos are incredibles. Everything is simple and easy. I had problem to understand JDBC on my college, and i didnt past exam. After i found this, i am sure next time i will pass.


  21. Comments  Chad Darby   |  Monday, 21 January 2019 at 11:43 am

    Wow! Thanks so much for the kind words πŸ™‚

  22. Comments  Raghu Prabhu   |  Sunday, 03 November 2019 at 1:47 am

    Hi Chad,

    I am 60+ and retired and learning new tricks to keep away Alzheimer at bay…Thank you for your very well made videos and clear and concise explanation of the java concepts, show how they work and how to implement.

    And most of all for making it available for free for everyone around the world. In Hinduism, a person who has acquired knowledge is a brahmin. You are one as you have reached that long time ago.

    The next step is the status of God, you become one by sharing the knowledge. You are one of that too…

    Thanks for your videos… BTW where can I download the zip file for the employee database???

  23. Comments  John Bleeker   |  Tuesday, 12 November 2019 at 10:08 pm

    Chad, thanks for your tutorials. there are plenty tutorial (IT and other) online. some make it past the 30 second mark and still get turned of (by me). Yours are concise, complete, and clear. I guess you are what people call, a natural. Despite the fact that I have been working in software development, I need to check from time to time how things are done, especially since i work projects and am frequently confronted with different tools and libraries. Even when if done something before, if its been several years, my knowledge tends to fade sometimes on some of the subjects. In IT projects there is never enough time to elaborate on those subjects. So, concise is just what we need. Your tutorials come in real handy.

    Keep up the good work, brother.
    (I mean, ‘brother’, since we re in the same field and both experienced, and both “luv2code”. You see, I’m one of those guys that in hind side realize he needs to explain why he used a certain expression that is definitely too cool for him to use. Well, at least in his universe (=mind) ) πŸ˜€ (Stop it, John! Stop already!) (Bye mom! Bye dad!, Bye Cathy) (Shut up!) πŸ˜‰

  24. Comments  Hussain   |  Wednesday, 25 August 2021 at 9:12 am

    I took “Java Database Connection” course from Udemy.One of your video required to download code from luv2code site. The code that you referring to is connection to database. But I couldn’t find that code from luv2code site. Can you please help me on that.

  25. Comments  Chad Darby   |  Wednesday, 25 August 2021 at 9:24 am

    Hi Hussain,

    Good question! Here’s the download link: http://www.luv2code.com/downloads/udemy-jdbc/jdbc-source-code-v2.zip

    Let me know if you need anything else πŸ™‚

Leave a Reply


ChΓ‘d (shod) Darby is a Java architect, author and instructor. He has over 20 years of Java development experience. Read more about him.

BTW: He luvs 2 code!

Follow Me

Subscribe via RSS