{"id":3416,"date":"2015-05-14T20:46:58","date_gmt":"2015-05-15T04:46:58","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=3416"},"modified":"2024-01-29T20:03:03","modified_gmt":"2024-01-30T03:03:03","slug":"mysql-jdbc-tutorial","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/","title":{"rendered":"MySQL JDBC"},"content":{"rendered":"\n<p>Java JDBC provides a standard interface to interact with any relational databases. In this tutorial series, you will learn how to use the MySQL JDBC Connector to connect Java programs to MySQL databases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What you&#8217;ll learn<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Overview of JDBC<\/li>\n\n\n\n<li>Setting up MySQL JDBC environment<\/li>\n\n\n\n<li>Perform common database operations including selecting, inserting, updating, and deleting data.<\/li>\n\n\n\n<li>Transactions<\/li>\n\n\n\n<li>Calling stored procedures<\/li>\n\n\n\n<li>Working with BLOB data<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisite<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Basic knowledge of MySQL<\/li>\n\n\n\n<li><a href=\"https:\/\/www.javazerotomastery.com\/\">Fundamental Java programming<\/a><\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"646\" height=\"304\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/mysql-jdbc.png\" alt=\"\" class=\"wp-image-9074\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/mysql-jdbc.png 646w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/09\/mysql-jdbc-200x94.png 200w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/figure>\n<\/div>\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 1. Getting Started<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"Introducing to JDBC\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/jdbc-overview\/\">Introduction to JDBC<\/a> &#8211; Learn about JDBC so that you can use it for interacting with MySQL databases. <\/li>\n\n\n\n<li><a title=\"Setting Up MySQL JDBC Development Environment\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/setting-up-mysql-jdbc-development-environment\/\">Setting Up MySQL JDBC Development Environment<\/a> &#8211; Show you how to set up a development environment that helps you work with MySQL and JDBC.<\/li>\n\n\n\n<li><a title=\"Connecting to MySQL Using JDBC Driver\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/connecting-to-mysql-using-jdbc-driver\/\">Connecting to MySQL Using JDBC Driver<\/a> &#8211; Learn how to connect to the MySQL database using the JDBC Connection object. <\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 2. CRUD<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"Querying Data From MySQL Using JDBC\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/querying-data-from-mysql-using-jdbc\/\">Querying Data From MySQL Using JDBC<\/a> &#8211; Guide you on how to query data from MySQL using JDBC Statement and ResultSet objects. <\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/update-data-in-mysql-using-jdbc-preparedstatement\/\">Updating Data in MySQL Using JDBC PreparedStatement<\/a> -Learn how to update data in the MySQL database using the JDBC PreparedStatement interface. <\/li>\n\n\n\n<li><a title=\"Inserting Data Into Table Using JDBC PreparedStatement\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/mysql-jdbc-insert\/\">Inserting Data Into Table Using JDBC PreparedStatement<\/a> &#8211; Learn how to use the PreparedStatement object to insert data into a table and get the inserted ID back. <\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 3. Transaction<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"MySQL JDBC Transaction\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/mysql-jdbc-transaction\/\">MySQL JDBC Transaction<\/a> &#8211; Learn how to use commit() and rollback() methods of the Connection object to control transactions. <\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 4. Calling MySQL Stored Procedures<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a title=\"Calling MySQL Stored Procedures from JDBC\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/calling-mysql-stored-procedures-from-jdbc\/\">Calling MySQL Stored Procedures from JDBC<\/a> &#8211; Show you how to call MySQL stored procedures from JDBC using the CallableStatement object. <\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">Section 5. Working with BLOB<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/writing-and-reading-mysql-blob-using-jdbc\/\">Writing and Reading MySQL BLOB Using JDBC<\/a> &#8211; Show you how to write and read MySQL BLOB data using JDBC API. <\/li>\n<\/ul>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Java JDBC API provides a standard interface to interact with any relational databases. In this MySQL JDBC tutorial section, we will show you how to use JDBC to interact with MySQL databases.<\/p>\n","protected":false},"author":2,"featured_media":10056,"parent":0,"menu_order":25,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-3416","page","type-page","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL JDBC Tutorial<\/title>\n<meta name=\"description\" content=\"This MySQL JDBC tutorial shows you how to use JDBC API to interact with MySQL databases.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL JDBC Tutorial\" \/>\n<meta property=\"og:description\" content=\"This MySQL JDBC tutorial shows you how to use JDBC API to interact with MySQL databases.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-30T03:03:03+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/\",\"name\":\"MySQL JDBC Tutorial\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-jdbc.svg\",\"datePublished\":\"2015-05-15T04:46:58+00:00\",\"dateModified\":\"2024-01-30T03:03:03+00:00\",\"description\":\"This MySQL JDBC tutorial shows you how to use JDBC API to interact with MySQL databases.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-jdbc.svg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/mysql-jdbc.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-jdbc-tutorial\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL JDBC\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL JDBC Tutorial","description":"This MySQL JDBC tutorial shows you how to use JDBC API to interact with MySQL databases.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"MySQL JDBC Tutorial","og_description":"This MySQL JDBC tutorial shows you how to use JDBC API to interact with MySQL databases.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/","og_site_name":"MySQL Tutorial","article_modified_time":"2024-01-30T03:03:03+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/","url":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/","name":"MySQL JDBC Tutorial","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-jdbc.svg","datePublished":"2015-05-15T04:46:58+00:00","dateModified":"2024-01-30T03:03:03+00:00","description":"This MySQL JDBC tutorial shows you how to use JDBC API to interact with MySQL databases.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-jdbc.svg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2021\/04\/mysql-jdbc.svg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-jdbc-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL JDBC"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/3416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=3416"}],"version-history":[{"count":5,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/3416\/revisions"}],"predecessor-version":[{"id":14595,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/3416\/revisions\/14595"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media\/10056"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=3416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}