{"id":79231,"date":"2020-07-02T09:00:34","date_gmt":"2020-07-02T03:30:34","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=79231"},"modified":"2020-07-02T09:00:34","modified_gmt":"2020-07-02T03:30:34","slug":"jdbc-tutorial","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/","title":{"rendered":"JDBC Tutorial &#8211; JDBC Architecture, Components and Working"},"content":{"rendered":"<p>In this JDBC tutorial, we will learn about the Performing Database Operations in Java using the JDBC API (SQL CREATE, INSERT, UPDATE, DELETE, and SELECT).<\/p>\n<p>We will look at the process of connecting Java with the database using JDBC. We will implement each example of performing operations on the database.<\/p>\n<p>In this JDBC tutorial, we will also discuss the composition and architecture of JDBC in Java. We will also see all the classes and interfaces used in the JDBC API. So, let us start the JDBC tutorial.<\/p>\n<h3>What is JDBC?<\/h3>\n<p>The term JDBC stands for Java Database Connectivity. JDBC is a specification from Sun microsystems. JDBC is an API(Application programming interface) in Java that helps users to interact or communicate with various databases.<\/p>\n<p>The classes and interfaces of JDBC API allow the application to send the request to the specified database.<\/p>\n<p>Using JDBC, we can write programs required to access databases. JDBC and the database driver are capable of accessing databases and spreadsheets. JDBC API is also helpful in accessing the enterprise data stored in a relational database(RDB).<\/p>\n<h3>Purpose of JDBC<\/h3>\n<p>There are some enterprise applications created using the JAVA EE(Enterprise Edition) technology. These applications need to interact with databases to store application-specific information.<\/p>\n<p>Interacting with the database requires efficient database connectivity, which we can achieve using ODBC(Open database connectivity) driver. We can use this ODBC Driver with the JDBC to interact or communicate with various kinds of databases, like Oracle, MS Access, Mysql, and SQL, etc.<\/p>\n<h3>Applications of JDBC<\/h3>\n<p>JDBC is fundamentally a specification that provides a complete set of interfaces. These interfaces allow for portable access to an underlying database.<\/p>\n<p>We can use Java to write different types of executables, such as:<\/p>\n<ul>\n<li>Java Applications<\/li>\n<li>Java Applets<\/li>\n<li>Enterprise JavaBeans (EJBs)<\/li>\n<li>Java Servlets<\/li>\n<li>Java ServerPages (JSPs)<\/li>\n<\/ul>\n<p>All these different executables can use a JDBC driver to access a database, and take advantage of the stored data. JDBC provides similar capabilities as ODBC by allowing Java programs to contain database-independent code.<\/p>\n<h3>The JDBC 4.0 Packages<\/h3>\n<p>There are two primary packages for JDBC 4.0: java.sql and javax.sql. JDBC 4.0 is the latest JDBC version at the time of writing this article. These packages offer the main classes for interacting with data sources.<\/p>\n<p>The new features in these packages include changes in the following areas:<\/p>\n<ul>\n<li>Automatic database driver loading.<\/li>\n<li>Exception handling improvements.<\/li>\n<li>National character set support.<\/li>\n<li>SQL ROWID access.<\/li>\n<li>Enhanced BLOB\/CLOB functionality.<\/li>\n<li>Connection and statement interface enhancements.<\/li>\n<li>SQL 2003 XML data type support.<\/li>\n<li>Annotations.<\/li>\n<\/ul>\n<h3>Components of JDBC<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/06\/Components-of-JDBC.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79329\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/06\/Components-of-JDBC.jpg\" alt=\"Components of JDBC\" width=\"540\" height=\"544\" \/><\/a><\/p>\n<p>Let us move further in the JDBC Tutorial and learn the JDBC components. There are mainly four main components of JDBC. These components help us to interact with a database. The components of JDBC are as follows:<\/p>\n<p><strong>1. JDBC API:<\/strong> The JDBC API provides various classes, methods, and interfaces that are helpful in easy communication with the database. It also provides two packages that contain the Java SE(Standard Edition) and Java EE(Enterprise Edition) platforms to exhibit the WORA(write once run everywhere) capabilities.<\/p>\n<p>There is also a standard in JDBC API to connect a database to a client application.<\/p>\n<p><strong>2. JDBC Driver Manager:<\/strong> The Driver Manager of JDBC loads database-specific drivers in an application. This driver manager establishes a connection with a database. It also makes a database-specific call to the database so that it can process the user request.<\/p>\n<p><strong>3. JDBC Test suite:<\/strong> The Test Suite of JDBC helps to test the operation such as insertion, deletion, updation that the JDBC Drivers perform.<\/p>\n<p><strong>4. JDBC-ODBC Bridge Drivers:<\/strong> The JDBC-ODBC Bridge Driver connects the database drivers to the database. This bridge driver translates the JDBC method call to the ODBC method call. It uses a package in which there is a native library to access ODBC characteristics.<\/p>\n<h3>Architecture of JDBC<\/h3>\n<p>The following figure shows the JDBC architecture:<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/06\/Architecture-of-JDBC.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79328\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/06\/Architecture-of-JDBC.jpg\" alt=\"Architecture of JDBC\" width=\"831\" height=\"1008\" \/><\/a><\/p>\n<p><strong>Description of the Architecture:<\/strong><\/p>\n<p><strong>1. Application:<\/strong> Application in JDBC is a Java applet or a Servlet that communicates with a data source.<\/p>\n<p><strong>2. JDBC API:<\/strong> JDBC API provides classes, methods, and interfaces that allow Java programs to execute SQL statements and retrieve results from the database. Some important classes and interfaces defined in JDBC API are as follows:<\/p>\n<ul>\n<li>DriverManager<\/li>\n<li>Driver<\/li>\n<li>Connection<\/li>\n<li>Statement<\/li>\n<li>PreparedStatement<\/li>\n<li>CallableStatement<\/li>\n<li>ResultSet<\/li>\n<li>SQL data<\/li>\n<\/ul>\n<p><strong>3. Driver Manager:<\/strong> The Driver Manager plays an important role in the JDBC architecture. The Driver manager uses some database-specific drivers that effectively connect enterprise applications to databases.<\/p>\n<p><strong>4. JDBC drivers:<\/strong> JDBC drivers help us to communicate with a data source through JDBC. We need a JDBC driver that can intelligently interact with the respective data source.<\/p>\n<h3>Types of JDBC Architecture<\/h3>\n<p>There are two types of processing models in JDBC architecture: two-tier and three-tier. These models help us to access a database. They are:<\/p>\n<h4>1. Two-tier model<\/h4>\n<p>In this model, a Java application directly communicates with the data source. JDBC driver provides communication between the application and the data source. When a user sends a query to the data source, the answers to those queries are given to the user in the form of results.<\/p>\n<p>We can locate the data source on a different machine on a network to which a user is connected. This is called a client\/server configuration, in which the user machine acts as a client, and the machine with the data source acts as a server.<\/p>\n<h4>2. Three-tier model<\/h4>\n<p>In the three-tier model, the query of the user queries goes to the middle-tier services. From the middle-tier service, the commands again reach the data source. The results of the query go back to the middle tier.<\/p>\n<p>From there, it finally goes to the user. This type of model is beneficial for management information system directors.<\/p>\n<h3>Prerequisites of JDBC<\/h3>\n<ul>\n<li>JDK(Java Development Kit)<\/li>\n<li>Oracle Database: Download it from<strong> http:\/\/www.oracle.com\/technetwork\/database\/database-technologies\/express-edition\/downloads\/index.html<\/strong><\/li>\n<li>JDBC driver for Oracle Database: Download it from <strong>http:\/\/www.oracle.com\/technetwork\/apps-tech\/jdbc-112010-090769.html<\/strong>. Add ojdbc6.jar to the project library.<\/li>\n<\/ul>\n<h3>Steps to connect Java program and database:<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/06\/Steps-to-connect-Java-Program-database.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79330\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/06\/Steps-to-connect-Java-Program-database.jpg\" alt=\"Steps to connect Java Program and database\" width=\"600\" height=\"538\" \/><\/a><\/p>\n<h4>1. Loading the Driver<\/h4>\n<p>We first need to load the driver or register it before using it in the program. There should be registration once in your program. We can register a driver in any of the two ways:<\/p>\n<p><strong>a. Class.forName():<\/strong> In this, we load the driver&#8217;s class file into memory during runtime. There is no need to use a new operator for the creation of an object. The following shows the use of Class.forName() to load the Oracle driver:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Class.forName(\u201coracle.jdbc.driver.OracleDriver\u201d);<\/pre>\n<p><strong>b. DriverManager.registerDriver():<\/strong> DriverManager is an inbuilt class of Java that comes with a static member register. We call the drivers class&#8217; constructor at compile-time. The following example shows the use of DriverManager.registerDriver() to register the Oracle driver:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver())<\/pre>\n<h4>2. Create the connections<\/h4>\n<p>After loading the driver, we need to establish connections using the following code:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Connection con = DriverManager.getConnection(url, user, password)<\/pre>\n<ul>\n<li>user: username from which sql command prompt can be accessed.<\/li>\n<li>password: password from which sql command prompt can be accessed.<\/li>\n<li>con: reference to Connection interface.<\/li>\n<li>url : Uniform Resource Locator. We can create it as follows:<\/li>\n<li>String url = \u201c jdbc:oracle:thin:@localhost:1521:xe\u201d<\/li>\n<\/ul>\n<p>Where oracle is the database, thin is the driver, @localhost is the IP Address where the database is stored, 1521 is the port number, and xe is the service provider. All three parameters are of String type and the programmer should declare them before calling the function.<\/p>\n<h4>3. Create a statement<\/h4>\n<p>Once you establish a connection, you can interact with the database. The JDBCStatement, CallableStatement, and PreparedStatement interfaces define the methods that allow us to send the SQL commands and receive data from the database.<\/p>\n<p>Use of JDBC Statement is as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Statement statement = con.createStatement()<\/pre>\n<p>Here, con is a reference to the Connection interface that we used in the previous step.<\/p>\n<h4>4. Execute the query<\/h4>\n<p>The most crucial part is executing the query. Here, Query is an SQL Query. Now, as we know that we can have multiple types of queries. Some of them are as follows:<\/p>\n<ul>\n<li>The query for updating or inserting tables in a database.<\/li>\n<li>The query for retrieving data from the database.<\/li>\n<\/ul>\n<p>The executeQuery() method of the Statement interface executes queries of retrieving values from the database. The executeQuery() method returns the object of ResultSet that we can use to get all the records of a table.<\/p>\n<h4>5. Close the connections<\/h4>\n<p>Till now, we have sent the data to the specified location. Now, we are about to complete our task. We need to close the connection. By closing the connection, objects of Statement and ResultSet interface are automatically closed. The close() method of Connection interface closes the connection.<\/p>\n<p><strong>Example :<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">con.close();<\/pre>\n<h3>Implementation<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.jdbctutorial;\nimport java.sql. * ;\nimport java.util. * ;\nclass JDBCTutorial {\n  public static void main(String a[]) {\n    \/\/Creating the connection \n    String url = \"jdbc:oracle:thin:@localhost:1521:xe\";\n    String user = \"system\";\n    String pass = \"12345\";\n\n    \/\/Entering the data \n    Scanner sc = new Scanner(System. in );\n    System.out.println(\"Enter name:\");\n    String name = sc.next();\n    System.out.println(\"Enter Roll number:\");\n    int rollNumber = sc.nextInt();\n    System.out.println(\"Enter class:\");\n    String cls = sc.next();\n\n    \/\/Inserting data using SQL query \n    String sql = \"insert into student values('\" + name + \"',\" + rollNumber + \",'\" + cls + \"')\";\n    Connection con = null;\n    try {\n      DriverManager.registerDriver(new oracle.jdbc.OracleDriver());\n\n      \/\/Reference to connection interface \n      con = DriverManager.getConnection(url, user, pass);\n\n      Statement st = con.createStatement();\n      int result = st.executeUpdate(sql);\n      if (result == 1) System.out.println(\"Inserted successfully: \" + sql);\n      else System.out.println(\"Insertion failed\");\n      con.close();\n    }\n    catch(Exception e) {\n      System.err.println(e);\n    }\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Enter name:<br \/>\nShreya<br \/>\nEnter Roll number:<br \/>\n123<br \/>\nEnter class:<br \/>\n8C<br \/>\nInserted successfully: insert into student values(&#8216;Shreya&#8217;, &#8216;123&#8217;, &#8216;8C&#8217;)<\/div>\n<h3>Working of JDBC<\/h3>\n<p>Now, moving ahead in this JDBC Tutorial, let us learn working of JDBC. A Java application that communicates with the database requires programming using JDBC API.<\/p>\n<p>We need to add Supporting data sources of JDBC Driver such as Oracle and SQL server in Java application for JDBC support. We can do this dynamically at run time. This JDBC driver intelligently interacts with the respective data source.<\/p>\n<h3>Creating a simple JDBC application<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.jdbctutorial;\nimport java.sql. * ;\npublic class JDBCTutorial {\n  public static void main(String args[]) throws ClassNotFoundException,\n  SQLException,\n  {\n    String driverName = \"sun.jdbc.odbc.JdbcOdbcDriver\";\n    String url = \"jdbc:odbc:XE\";\n    String username = \"John\";\n    String password = \"john12\";\n    String query1 = \"insert into students values(101, 'Pooja')\";\n\n    \/\/Load the driver class \n    Class.forName(driverName);\n\n    \/\/Obtaining a connection \n    Connection con = DriverManager.getConnection(url, username, password);\n\n    \/\/Obtaining a statement \n    Statement stmt = con.createStatement();\n\n    \/\/Executing the query \n    int count = stmt.executeUpdate(query1);\n    System.out.println(\"The number of rows affected by this query= \" + count);\n\n    \/\/Closing the connection \n    con.close();\n  }\n}<\/pre>\n<p>The above example shows the basic steps to access a database using JDBC. We used the JDBC-ODBC bridge driver to connect to the database. We have to import the java.sql package that provides basic SQL functionality.<\/p>\n<h3>Principal JDBC Interfaces and Classes<\/h3>\n<p>Let us take an overview look at the principal interfaces and classes of JDBC. They are all present in the java.sql package.<\/p>\n<h4>1. Class.forName()<\/h4>\n<p>This method loads the driver\u2019s class file into memory at runtime. There is no need to use new or creation of objects.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Class.forName(\"oracle.jdbc.driver.OracleDriver\");<\/pre>\n<h4>2. DriverManager<\/h4>\n<p>The DriverManager class registers drivers for a specific database type. For example, Oracle Database in this tutorial. This class also establishes a database connection with the server using its getConnection() method.<\/p>\n<h4>3. Connection<\/h4>\n<p>The Connection interface represents an established database connection. Using this connection, we can create statements to execute queries and retrieve results. We can also get metadata about the database, close the connection, etc.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Connection con = DriverManager.getConnection\n(\"jdbc:oracle:thin:@localhost:1521:orcl\", \"login1\", \"pwd1\");\n<\/pre>\n<h4>4. Statement and PreparedStatement<\/h4>\n<p>The Statement and PreparedStatement interfaces execute a static SQL query and parameterized SQL queries. The statement interface is the super interface of the PreparedStatement interface. The commonly used methods of these interfaces are:<\/p>\n<p><strong>a. boolean execute(String sql):<\/strong> This method executes a general SQL statement. It returns true if the query returns a ResultSet and false if the query returns nothing. We can use this method with a Statement only.<\/p>\n<p><strong>b. int executeUpdate(String sql):<\/strong> This method executes an INSERT, UPDATE, or DELETE statement. It then returns an updated account showing the number of rows affected. For example, 1 row inserted, or 2 rows updated, or 0 rows affected, etc.<\/p>\n<p><strong>c. ResultSet executeQuery(String sql):<\/strong> This method executes a SELECT statement and returns an object of ResultSet. This returned object contains results returned by the query.<\/p>\n<h4>5. ResultSet<\/h4>\n<p>The ResultSet is an interface that contains table data returned by a SELECT query. We use the object of ResultSet to iterate over rows using the next() method.<\/p>\n<h4>6. SQLException<\/h4>\n<p>The SQLException class is a checked exception. We declare it to so all the above methods can throw this exception. We have to provide a mechanism to explicitly catch this exception when we call the methods of the above classes.<\/p>\n<h3>Implementing Insert Statement in JDBC<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.jdbctutorial;\nimport java.sql. * ;\npublic class InsertStatementDemo {\n  public static void main(String args[]) {\n    String id = \"id1\";\n    String password = \"pswd1\";\n    String fullname = \"TechVidvan\";\n    String email = \"techvidvan.com\";\n\n    try {\n      Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n      Connection con = DriverManager.getConnection(\" \n      jdbc:oracle:thin:@localhost:1521:orcl\", \"login1\", \"pswd1\");\n      Statement stmt = con.createStatement();\n\n      \/\/ Inserting data in database \n      String s1 = \"insert into userid values('\" + id + \"', '\" + password + \"', '\" + fullname + \"', '\" + email + \"')\";\n      int result = stmt.executeUpdate(s1);\n      if (result &gt; 0) System.out.println(\"Successfully Registered\");\n      else System.out.println(\"Insertion Failed\");\n      con.close();\n    }\n    catch(Exception e) {\n      System.out.println(e);\n    }\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Successfully Registered<\/div>\n<h3>Implementing Update Statement in JDBC<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.jdbctutorial;\nimport java.sql. * ;\npublic class UpdateStatementDemo {\n  public static void main(String args[]) {\n    String id = \"id1\";\n    String password = \"pswd1\";\n    String newPassword = \"newpswd\";\n    try {\n      Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n      Connection con = DriverManager.getConnection(\" \n      jdbc:oracle:thin:@localhost:1521:orcl\", \"login1\", \"pswd1\");\n      Statement stmt = con.createStatement();\n\n      \/\/ Updating database \n      String s1 = \"UPDATE userid set password = '\" + newPassword + \"' WHERE id = '\" + id + \"' AND password = '\" + password + \"'\";\n      int result = stmt.executeUpdate(s1);\n\n      if (result &gt; 0) System.out.println(\"Password Updated Successfully \");\n      else System.out.println(\"Error Occured!!Could not update\");\n      con.close();\n    }\n    catch(Exception e) {\n      System.out.println(e);\n    }\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Password Updated Successfully<\/div>\n<h3>Implementing Delete Statement in JDBC<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.jdbctutorial;\nimport java.sql. * ;\npublic class DeleteStatementDemo {\n  public static void main(String args[]) {\n    String id = \"id2\";\n    String password = \"pswd\";\n    try {\n      Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n      Connection con = DriverManager.getConnection(\" \n      jdbc:oracle:thin:@localhost:1521:orcl\", \"login1\", \"pswd1\");\n      Statement stmt = con.createStatement();\n\n      \/\/Deleting from database \n      String s1 = \"DELETE from userid WHERE id = '\" + id + \"' AND password = '\" + pswd + \"'\";\n\n      int result = stmt.executeUpdate(s1);\n\n      if (result &gt; 0) System.out.println(\"One User Successfully Deleted\");\n      else System.out.println(\"Error Occured!!Could not delete\");\n\n      con.close();\n    }\n    catch(Exception e) {\n      System.out.println(e);\n    }\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">One User Successfully Deleted<\/div>\n<h3>Implementing Select Statement in JDBC<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.jdbctutorial;\nimport java.sql. * ;\npublic class SelectStatementDemo {\n  public static void main(String args[]) {\n    String id = \"id1\";\n    String password = \"pwd1\";\n    try {\n      Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n      Connection con = DriverManager.getConnection(\" \n      jdbc:oracle:thin:@localhost:1521:orcl\", \"login1\", \"pwd1\");\n      Statement stmt = con.createStatement();\n\n      \/\/SELECT query \n      String s1 = \"select * from userid WHERE id = '\" + id + \"' AND pwd = '\" + pwd + \"'\";\n      ResultSet rs = stmt.executeQuery(s1);\n      if (rs.next()) {\n        System.out.println(\"User-id: \" + rs.getString(1));\n        System.out.println(\"Full Name: \" + rs.getString(3));\n        System.out.println(\"E-mail: \" + rs.getString(4));\n      }\n      else {\n        System.out.println(\"This id is already registered\");\n      }\n      con.close();\n    }\n    catch(Exception e) {\n      System.out.println(e);\n    }\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">User-Id: id1<br \/>\nFull Name: TechVidvan<br \/>\nE-mail: techvidvan.com<\/div>\n<h3>Conclusion<\/h3>\n<p>In this JDBC tutorial, we learned how to perform the various database operations in Java. We also discussed various programs and steps of Connecting to a database.<\/p>\n<p>Then we learned to execute the INSERT statement, the SELECT Statement, the UPDATE statement, AND the DELETE statement with an example program. We covered the architecture and components of JDBC.<\/p>\n<p>We hope this article will surely help you in performing database operations in Java.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this JDBC tutorial, we will learn about the Performing Database Operations in Java using the JDBC API (SQL CREATE, INSERT, UPDATE, DELETE, and SELECT). We will look at the process of connecting Java&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":79327,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[2958,2959,2960,2961],"class_list":["post-79231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-java-jdbc","tag-java-jdbc-tutorial","tag-jdbc-architecture","tag-jdbc-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JDBC Tutorial - JDBC Architecture, Components and Working - TechVidvan<\/title>\n<meta name=\"description\" content=\"JDBC Tutorial to learn what is JDBC and its uses, its architecture &amp; components, Steps to connect Java program &amp; database, JDBC working, interfaces, classes\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JDBC Tutorial - JDBC Architecture, Components and Working - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"JDBC Tutorial to learn what is JDBC and its uses, its architecture &amp; components, Steps to connect Java program &amp; database, JDBC working, interfaces, classes\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-02T03:30:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/06\/JDBC-Tutorial-tv.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JDBC Tutorial - JDBC Architecture, Components and Working - TechVidvan","description":"JDBC Tutorial to learn what is JDBC and its uses, its architecture & components, Steps to connect Java program & database, JDBC working, interfaces, classes","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:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"JDBC Tutorial - JDBC Architecture, Components and Working - TechVidvan","og_description":"JDBC Tutorial to learn what is JDBC and its uses, its architecture & components, Steps to connect Java program & database, JDBC working, interfaces, classes","og_url":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-07-02T03:30:34+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/06\/JDBC-Tutorial-tv.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"JDBC Tutorial &#8211; JDBC Architecture, Components and Working","datePublished":"2020-07-02T03:30:34+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/"},"wordCount":1987,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/06\/JDBC-Tutorial-tv.jpg","keywords":["java jdbc","java jdbc tutorial","jdbc architecture","JDBC Tutorial"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/","url":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/","name":"JDBC Tutorial - JDBC Architecture, Components and Working - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/06\/JDBC-Tutorial-tv.jpg","datePublished":"2020-07-02T03:30:34+00:00","description":"JDBC Tutorial to learn what is JDBC and its uses, its architecture & components, Steps to connect Java program & database, JDBC working, interfaces, classes","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/06\/JDBC-Tutorial-tv.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/06\/JDBC-Tutorial-tv.jpg","width":1200,"height":628,"caption":"Java JDBC Tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/jdbc-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"JDBC Tutorial &#8211; JDBC Architecture, Components and Working"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=79231"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79231\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/79327"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=79231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=79231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=79231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}