{"id":22156,"date":"2015-04-14T11:00:02","date_gmt":"2015-04-14T08:00:02","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=22156"},"modified":"2019-03-05T13:09:10","modified_gmt":"2019-03-05T11:09:10","slug":"jdbc-batch-update-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/","title":{"rendered":"JDBC Batch Update Example"},"content":{"rendered":"<h2>1. Introduction<\/h2>\n<p>This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (<em>Java DataBase Connectivity<\/em>) API which is just one of the tools in Java for connecting to a database from a client. The API provides several simple methods for querying and updating data in a database.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nConsider a situation in which hundreds or more database records need to be affected, that is updated, inserted or deleted. Making a network call for each operation could mean more time, more network traffic, more communication overhead which&nbsp;could adversely hit performance. This is when \u201cBatch Update\u201d comes into the picture. \u2018Batch Operation\u2019 implies grouping a certain chunk of operations into one unit.<\/p>\n<p>The official page reads: \u201c<em>The batch update facility allows a Statement object to submit a set of heterogeneous SQL statements together as a single unit, or batch, to the underlying data source.<\/em>\u201d What it means&nbsp;is, if there are say, 200 database operations that need to be performed then instead of each operation hitting the database once we can have the 200 operations \u2018batched\u2019 into say, 4 batches of 50 operations each. Thus the database would be hit just 4 times instead of the earlier 200 times. The JDBC specification limits the number of operations in a Batch to a max size of 100 but individual databases may have their own limits.<\/p>\n<p>This article demonstrates the use of JDBC Batch Update operation. It talks about the two ways in which \u2018Batch Update\u2019 can be done using <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/Statement.html\" target=\"_blank\" rel=\"noopener noreferrer\">Statement<\/a><\/code> and <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/PreparedStatement.html\">PreparedStatement<\/a><\/code> objects. Though the example revolves around <code>update<\/code>; <code>delete<\/code> and <code>insert<\/code> operations can also be \u2018batched\u2019. Of course, batching <code>select<\/code> statements does not make much sense. One thing to be mindful about is that the database executes each operation in the batch separately. So what happens if any one of the operations in the \u2018batch\u2019 fails? Well that might leave the database in an inconsistent state. How should that be handled? This is when \u2018transactions\u2019 come to the rescue. It is a feature of the <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/Connection.html\" target=\"_blank\" rel=\"noopener noreferrer\">Connection<\/a><\/code> object. We are going to run our Batch operations in transactions, which can be thought of as \u2018atomic execution units\u2019. So if all operations in a batch succeed, the whole transaction succeeds. But if any one of the operations fails, the whole transaction is made to fail or is rolled back. This ensures that the database state always stays consistent. The complete working example is available at the end of the article for reference.<\/p>\n<h2>2. Example Walk-through<\/h2>\n<h3>2.1 Technologies used in this demonstration<\/h3>\n<ul>\n<li><a title=\"Download Java\" href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/java-archive-downloads-javase6-419409.html\" target=\"_blank\" rel=\"noopener noreferrer\">Java 1.6<\/a><\/li>\n<li><a title=\"Download Eclipse\" href=\"https:\/\/eclipse.org\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">Eclipse IDE<\/a><\/li>\n<li><a title=\"MySQL DB\" href=\"https:\/\/dev.mysql.com\/downloads\/windows\/\" target=\"_blank\" rel=\"noopener noreferrer\">MySQL 5.0 as the DataBase<\/a><\/li>\n<li><a title=\"MySql Connector\" href=\"https:\/\/www.mysql.com\/products\/connector\/\" target=\"_blank\" rel=\"noopener noreferrer\">MySql 5.0 jar to connect to the database from Eclipse<\/a><\/li>\n<\/ul>\n<h3>2.2 Sample data used in the Example<\/h3>\n<p><figure id=\"attachment_24097\" aria-describedby=\"caption-attachment-24097\" style=\"width: 780px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/admin-ajax.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/admin-ajax.jpg\" alt=\"Figure 1: Sample Data\" width=\"780\" height=\"220\" class=\"size-full wp-image-24097\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/admin-ajax.jpg 780w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/admin-ajax-300x85.jpg 300w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a><figcaption id=\"caption-attachment-24097\" class=\"wp-caption-text\">Sample Data<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3>2.3 Project Structure used<\/h3>\n<p><figure id=\"attachment_24072\" aria-describedby=\"caption-attachment-24072\" style=\"width: 448px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/05\/1projStructure.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/05\/1projStructure.jpg\" alt=\"Project structure\" width=\"448\" height=\"292\" class=\"size-full wp-image-24072\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/05\/1projStructure.jpg 448w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/05\/1projStructure-300x196.jpg 300w\" sizes=\"(max-width: 448px) 100vw, 448px\" \/><\/a><figcaption id=\"caption-attachment-24072\" class=\"wp-caption-text\">Project structure<\/figcaption><\/figure><\/p>\n<h2>3. Approach 1: Jdbc Batch Update using Statement object<\/h2>\n<ul>\n<li><strong>First create a Connection object<\/strong><em><strong>Note<\/strong>: import statements, try..catch etc. have been removed for the sake of brevity.<\/em><br \/>\n&nbsp;<br \/>\n<span style=\"text-decoration: underline\"><em>ConnectionObject.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class ConnectionObject {\n\tstatic String DB_DRIVER = \"com.mysql.jdbc.Driver\";\n\tstatic String DB_CONNECTION = \"jdbc:mysql:\/\/localhost:3306\/test\";\n\tstatic String DB_USER = \"userName\";\n\tstatic String DB_PASSWORD = \"password\";\n\n\tpublic static Connection getConnection() {\n\t\tConnection connection = null;\n\t\tClass.forName(DB_DRIVER);\n\t\tconnection = DriverManager.getConnection(DB_CONNECTION, DB_USER,\n\t\t\t\tDB_PASSWORD);\n\t\treturn connection;\n\t}\n}\n<\/pre>\n<\/li>\n<li><strong>Create a Statement object<\/strong>The <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/Statement.html\" target=\"_blank\" rel=\"noopener noreferrer\">Statement<\/a><\/code> object offers two methods: <code>addBatch()<\/code> and <code>executeBatch()<\/code> that we can use. The first method is used to create a \u2018batch\u2019 of statements and the latter is used to execute the batch as one unit. It returns an <code>int[]<\/code> array that indicates the number of records affected by each statement in the Batch. Pretty neat and simple just that the database query needs to be repeated in each statement (<em>refer sample code below)<\/em>.<\/li>\n<li><strong>Turn auto-commit off<\/strong><br \/>\nThis is done so that all the Batch statements execute in a single transaction and no operation in the batch is committed individually.<\/li>\n<li><strong>Use <code>addBatch()<\/code><\/strong><br \/>\nAdd as many statements as required to the Batch using this method.<\/li>\n<li><strong>Execute the Batch using <code>executeBatch()<\/code><\/strong><br \/>\nThen execute the Batch of statements by invoking the <code>executeBatch()<\/code> as shown below<\/li>\n<li><strong>Finally commit or roll-back the transaction<\/strong><\/li>\n<li><strong>Code Snippet as below<\/strong><br \/>\n&nbsp;<br \/>\n<span style=\"text-decoration: underline\"><em>batchUpdateUsingStatement() method<\/em><\/span>[ulp id=&#8217;TD36VgQCKfhTAygK&#8217;]<\/p>\n<pre class=\"brush:java\">\tpublic void batchUpdateUsingStatement() throws SQLException {\n\n\t\t\/\/ This is to hold the response of executeBatch()\n\t\tint[] result = null;\n\t\ttry {\n\t\t\tStatement stmt = connection.createStatement();\n\n\t\t\tconnection.setAutoCommit(false); \/\/ Setting auto-commit off\n\t\t\tString SQL = \"update person set firstName='New First Name', lastName='New Last Name' where id=1\";\n\t\t\tstmt.addBatch(SQL); \/\/ add statement to Batch\n\t\t\tSQL = \"update person set firstName='First Name',lastName='Last Name' where id=2\";\n\t\t\tstmt.addBatch(SQL); \/\/ add second statement to Batch\n\t\t\tresult = stmt.executeBatch(); \/\/ execute the Batch\n\t\t\tconnection.commit(); \/\/ commit\n\t\t} catch (SQLException e) {\n\t\t\tconnection.rollback(); \/\/ rollBack in case of an exception\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tif (connection != null)\n\t\t\t\tconnection.close(); \/\/ finally close the connection\n\t\t}\n\t\tSystem.out.println(\"Number of rows affected: \" + result.length);\n\t}\n<\/pre>\n<\/li>\n<\/ul>\n<h2>4. Approach 2: Jdbc Batch Update using PreparedStatement<\/h2>\n<ul>\n<li><strong>Create a <code>PreparedStatement<\/code> object<\/strong><br \/>\n<code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/PreparedStatement.html\">PreparedStatement<\/a><\/code> also exposes two methods for adding statements to the Batch and executing them as those offered by <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/Statement.html\" target=\"_blank\" rel=\"noopener noreferrer\">Statement<\/a><\/code> object. But it allows reusing the SQL query by just substituting the parameters in each query. It promises a better performance than the simple <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/Statement.html\" target=\"_blank\" rel=\"noopener noreferrer\">Statement<\/a><\/code> object. Besides, it also helps to check against SQL injection threat. Observe the &#8216;?&#8217; used to substitute the actual parameter values in the code below. The parameter value is supplied by specifying the appropriate parameter index in the corresponding &#8216;set&#8217; method.<\/li>\n<li><strong>Turn Auto-Commit Off<\/strong><br \/>\nThis to enable Batch processing in a single transaction as explained above<\/li>\n<li><strong>Set and Add<\/strong><br \/>\nSet the values of each parameter into the query and add the statement to the Batch<\/li>\n<li><strong>Execute the batch<\/strong><br \/>\nFinally execute the batch of statements<\/li>\n<li><strong>Commit or Roll-back<\/strong><br \/>\nThen commit or roll-back the transaction as shown in the code below.<\/li>\n<li><strong>Code Snippet as below<\/strong><br \/>\n&nbsp;<br \/>\n<span style=\"text-decoration: underline\"><em>batchUpdateUsingPreparedStatement() method<\/em><\/span><\/p>\n<pre class=\"brush:java\">\tpublic void batchUpdateUsingPreparedStatement() throws SQLException {\n\n\t\tint[] result = null;\n\t\tString SQL = \"update person set firstName=?,lastName=? where id=?\"; \n\t\t\/\/ '?' is the placeholder for the parameter\n\t\ttry {\n\t\t\tPreparedStatement stmt = connection.prepareStatement(SQL);\n\t\t\tconnection.setAutoCommit(false);\n\t\t\tstmt.setString(1, \"Abc\"); \/\/ Value for the first parameter, namely 'firstName'\n\t\t\tstmt.setString(2, \"Def\"); \/\/ Value for the second parameter, namely 'lastName'\n\t\t\tstmt.setInt(3, 1); \/\/ Value for the third parameter, namely 'id'\n\t\t\tstmt.addBatch(); \/\/ Add to Batch\n\n\t\t\tstmt.setString(1, \"Xyz\");\n\t\t\tstmt.setString(2, \"Uvw\");\n\t\t\tstmt.setInt(3, 2);\n\t\t\tstmt.addBatch(); \/\/ Add second query to the Batch\n\t\t\tresult = stmt.executeBatch(); \/\/ execute the Batch and commit\n\t\t\tconnection.commit();\n\t\t} catch (SQLException e) {\n\t\t\tconnection.rollback();\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\tif (connection != null)\n\t\t\t\tconnection.close();\n\t\t}\n\t\tSystem.out.println(\"Number of rows affected: \" + result.length);\n\t}\n<\/pre>\n<\/li>\n<\/ul>\n<h2>5. Download the source code<\/h2>\n<p>This concludes our example of using JDBC Batch Update using both <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/Statement.html\" target=\"_blank\" rel=\"noopener noreferrer\">Statement<\/a><\/code> and <code><a href=\"http:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/sql\/PreparedStatement.html\">PreparedStatement<\/a><\/code>. As promised, the example code has been shared below.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nDownload the full source code of this example here: <strong><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/JdbcBatchUpdateExample.zip\">JdbcBatchUpdateExample<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java DataBase Connectivity) API which is just one of the tools in Java for connecting to a database from a client. The API provides several simple methods for querying and updating data &hellip;<\/p>\n","protected":false},"author":49,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[826,216],"class_list":["post-22156","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-batch-operation-jdbc","tag-jdbc-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JDBC Batch Update Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JDBC Batch Update Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-14T08:00:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-05T11:09:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Joormana Brahma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Joormana Brahma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\"},\"author\":{\"name\":\"Joormana Brahma\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/dc9d2ec72b84cc70ec2cda0edea4f999\"},\"headline\":\"JDBC Batch Update Example\",\"datePublished\":\"2015-04-14T08:00:02+00:00\",\"dateModified\":\"2019-03-05T11:09:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\"},\"wordCount\":831,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"batch operation jdbc\",\"jdbc\"],\"articleSection\":[\"sql\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\",\"name\":\"JDBC Batch Update Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2015-04-14T08:00:02+00:00\",\"dateModified\":\"2019-03-05T11:09:10+00:00\",\"description\":\"1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"sql\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JDBC Batch Update Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/dc9d2ec72b84cc70ec2cda0edea4f999\",\"name\":\"Joormana Brahma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/Joormana-Brahma-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/Joormana-Brahma-96x96.jpg\",\"caption\":\"Joormana Brahma\"},\"description\":\"She has done her graduation in Computer Science and Technology from Guwahati, Assam. She is currently working in a small IT Company as a Software Engineer in Hyderabad, India. She is a member of the Architecture team that is involved in development and quite a bit of R&amp;D. She considers learning and sharing what has been learnt to be a rewarding experience.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/joormana-brahma\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JDBC Batch Update Example - Java Code Geeks","description":"1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java","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:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/","og_locale":"en_US","og_type":"article","og_title":"JDBC Batch Update Example - Java Code Geeks","og_description":"1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-04-14T08:00:02+00:00","article_modified_time":"2019-03-05T11:09:10+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Joormana Brahma","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Joormana Brahma","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/"},"author":{"name":"Joormana Brahma","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/dc9d2ec72b84cc70ec2cda0edea4f999"},"headline":"JDBC Batch Update Example","datePublished":"2015-04-14T08:00:02+00:00","dateModified":"2019-03-05T11:09:10+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/"},"wordCount":831,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["batch operation jdbc","jdbc"],"articleSection":["sql"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/","name":"JDBC Batch Update Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2015-04-14T08:00:02+00:00","dateModified":"2019-03-05T11:09:10+00:00","description":"1. Introduction This article presents a simple example of performing JDBC Batch Update. It assumes that the reader is familiar with the JDBC (Java","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-batch-update-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"sql","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/"},{"@type":"ListItem","position":5,"name":"JDBC Batch Update Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/dc9d2ec72b84cc70ec2cda0edea4f999","name":"Joormana Brahma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/Joormana-Brahma-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/04\/Joormana-Brahma-96x96.jpg","caption":"Joormana Brahma"},"description":"She has done her graduation in Computer Science and Technology from Guwahati, Assam. She is currently working in a small IT Company as a Software Engineer in Hyderabad, India. She is a member of the Architecture team that is involved in development and quite a bit of R&amp;D. She considers learning and sharing what has been learnt to be a rewarding experience.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/joormana-brahma\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/22156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/49"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=22156"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/22156\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=22156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=22156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=22156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}