{"id":48914,"date":"2017-08-03T11:00:34","date_gmt":"2017-08-03T08:00:34","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=48914"},"modified":"2019-03-05T13:04:17","modified_gmt":"2019-03-05T11:04:17","slug":"jdbc-oracle-thin-driver-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/","title":{"rendered":"JDBC with Oracle Thin Driver Example"},"content":{"rendered":"<p><strong>Java Database Connectivity<\/strong> (JDBC) is a Java-based data access technology that defines how a client may access a database. It provides methods for querying and updating the data in a database. The JDBC classes are contained in the Java package i.e. <code>java.sql<\/code> and <code>javax.sql<\/code>.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;\n<\/p>\n<h2>1. Introduction<\/h2>\n<p>In this JDBC Oracle connectivity example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle Database Express Edition using JDBC API.<\/p>\n<h3>1.1 What is JDBC?<\/h3>\n<p>The JDBC API is a Java API that can access any kind of tabular data, especially the data stored in a relational database. The JDBC API defines interfaces and classes for writing the database applications in Java by making the database connections. Using JDBC one can send <em>statements<\/em> to almost any relational database. Thus, JDBC is a Java API for executing <code>SQL<\/code> statements and supports basic <code>SQL<\/code> functionality.<\/p>\n<p>In short, <em>JDBC is an API which provides communication between a Java application and the database in a database independent and platform independent manner<\/em>.<\/p>\n<p><figure id=\"attachment_48915\" aria-describedby=\"caption-attachment-48915\" style=\"width: 532px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-system-architecture-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48915\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-system-architecture-1.jpg\" alt=\"Fig. 1: Java Database Connectivity (JDBC) Architecture\" width=\"532\" height=\"411\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-system-architecture-1.jpg 532w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-system-architecture-1-300x232.jpg 300w\" sizes=\"(max-width: 532px) 100vw, 532px\" \/><\/a><figcaption id=\"caption-attachment-48915\" class=\"wp-caption-text\">Fig. 1: Java Database Connectivity (JDBC) Architecture<\/figcaption><\/figure><\/p>\n<p>JDBC lets a developer manage the below three important programming activities, i.e.:<\/p>\n<ol>\n<li>Connection to a database.<\/li>\n<li>Sending queries and update statements to the database.<\/li>\n<li>Retrieving and processing the results received from the database in answer to the <code>SQL<\/code> query.<\/li>\n<\/ol>\n<p>The following simple code fragment gives an example of these three steps,<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Example.java<\/em><\/span><\/p>\n<pre class=\"brush:java; wrap-lines:false;\">Connection connObj = DriverManager.getConnection(\"jdbc:myDriver:testDb\", \"myLoginId\", \"myPassword\");\n\t\t\t  \nStatement stmtObj = connObj.createStatement();\nResultSet resObj = stmtObj.executeQuery(\"SELECT test_id, test_name, test_salary FROM testTable\");\nwhile (resObj.next()) {\n\tint id = resObj.getInt(\"test_id \");\n\tString name = resObj.getString(\"test_name \");\n\tfloat salary = resObj.getFloat(\"test_salary \");\n}\n<\/pre>\n<h3>1.2 What Is ODBC?<\/h3>\n<p>Before JDBC, <strong>ODBC<\/strong> API was used to communicate with the databases. ODBC API uses <em>ODBC Drivers<\/em> to interact with the databases. Since ODBC drivers are entirely written in <code>C<\/code> language, therefore, they are platform dependent and cause the portability issues.<\/p>\n<p>That is why Java has defined its own JDBC API and uses the JDBC drivers (written entirely in the Java language) to interact with the databases.<\/p>\n<h3>1.3 What are JDBC Drivers?<\/h3>\n<p>A JDBC Driver is a software component that enables the Java application to interact with the database. The four different types of JDBC drivers are:<\/p>\n<ul>\n<li><strong>Type 1<\/strong>: JDBC-ODBC Bridge Driver<\/li>\n<li><strong>Type 2<\/strong>: JDBC-Native API Driver<\/li>\n<li><strong>Type 3<\/strong>: Network Protocol Driver<\/li>\n<li><strong>Type 4<\/strong>: Thin Driver<\/li>\n<\/ul>\n<h4>1.3.1 JDBC-ODBC Bridge Driver<\/h4>\n<p>The Type 1 driver translates all the JDBC calls into ODBC calls and sends them to the ODBC driver. Since ODBC is a generic API this driver is now discouraged because of Type 4 Thin Driver.<\/p>\n<p><figure id=\"attachment_48916\" aria-describedby=\"caption-attachment-48916\" style=\"width: 615px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48916\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-1.jpg\" alt=\"Fig. 2: JDBC-ODBC Bridge Driver\" width=\"615\" height=\"255\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-1.jpg 615w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-1-300x124.jpg 300w\" sizes=\"(max-width: 615px) 100vw, 615px\" \/><\/a><figcaption id=\"caption-attachment-48916\" class=\"wp-caption-text\">Fig. 2: JDBC-ODBC Bridge Driver<\/figcaption><\/figure><\/p>\n<p><span style=\"text-decoration: underline;\">Advantages<\/span><\/p>\n<ul>\n<li>The JDBC-ODBC bridge allows access to almost any database since the database\u2019s ODBC drivers are already available.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\">Disadvantages<\/span><\/p>\n<ul>\n<li>A performance issue is observed as the JDBC call goes through the bridge to the ODBC driver and then to the database. This applies even in the reverse process and thus making it as a slowest of all driver types.<\/li>\n<li>The ODBC driver needs to be installed on the client machine.<\/li>\n<\/ul>\n<h4>1.3.2 JDBC-Native API Driver<\/h4>\n<p>The Native API driver uses the client-side libraries of the database. The driver converts JDBC method calls into native calls of the database API i.e. database-specific calls. For e.g., Oracle will have Oracle Native API.<\/p>\n<p><figure id=\"attachment_48917\" aria-describedby=\"caption-attachment-48917\" style=\"width: 582px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48917\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-2.jpg\" alt=\"Fig. 3: JDBC-Native API Driver\" width=\"582\" height=\"310\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-2.jpg 582w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-2-300x160.jpg 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><figcaption id=\"caption-attachment-48917\" class=\"wp-caption-text\">Fig. 3: JDBC-Native API Driver<\/figcaption><\/figure><\/p>\n<p><span style=\"text-decoration: underline;\">Advantages<\/span><\/p>\n<ul>\n<li>The distinctive characteristic of Type 2 JDBC drivers are that they typically offer better performance than the JDBC-ODBC Bridge as the layers of communication are less than that of Type 1.<\/li>\n<li>Type 2 uses the Native API which is database specific.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\">Disadvantages<\/span><\/p>\n<ul>\n<li>Native API must be installed on the client system and hence Type 2 drivers cannot be used for the internet.<\/li>\n<li>The Vendor client library also needs to be installed on the client machine.<\/li>\n<li>Usually, Type 3 drivers are not <strong>thread-safe<\/strong>.<\/li>\n<li>In the case of Type 3 drivers, if we change the database we have to change the Native API as it is specific to a particular database.<\/li>\n<\/ul>\n<h4>1.3.3 Network Protocol Driver<\/h4>\n<p>The Network Protocol driver uses the middleware (i.e. application or web server) that converts the JDBC calls directly or indirectly into a vendor-specific database protocol.<\/p>\n<p><figure id=\"attachment_48918\" aria-describedby=\"caption-attachment-48918\" style=\"width: 613px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48918\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-3.jpg\" alt=\"Fig. 4: Network Protocol Driver\" width=\"613\" height=\"278\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-3.jpg 613w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-3-300x136.jpg 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><figcaption id=\"caption-attachment-48918\" class=\"wp-caption-text\">Fig. 4: Network Protocol Driver<\/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<p><span style=\"text-decoration: underline;\">Advantages<\/span><\/p>\n<ul>\n<li>This driver is server-based, so there is no need for any vendor database library to be present on the client machines.<\/li>\n<li>This driver is fully written in Java and hence offers portability.<\/li>\n<li>The Type 3 driver typically provides support for features such as caching (connections, query results etc.), load balancing etc.<\/li>\n<li>This driver is very flexible and allows access to multiple databases using a single driver.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\">Disadvantages<\/span><\/p>\n<ul>\n<li>Network support is required on the client machines.<\/li>\n<li>Requires database-specific coding to be done in the middle tier.<\/li>\n<li>Maintenance of network protocol driver becomes costly as it requires database-specific coding to be done in the middle tier.<\/li>\n<\/ul>\n<h4>1.3.4 Thin Driver<\/h4>\n<p>The Thin Driver converts the JDBC calls directly into a vendor-specific database protocol.<\/p>\n<p><figure id=\"attachment_48920\" aria-describedby=\"caption-attachment-48920\" style=\"width: 483px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48920\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-4.jpg\" alt=\"Fig. 5: Thin Driver\" width=\"483\" height=\"314\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-4.jpg 483w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-driver-4-300x195.jpg 300w\" sizes=\"(max-width: 483px) 100vw, 483px\" \/><\/a><figcaption id=\"caption-attachment-48920\" class=\"wp-caption-text\">Fig. 5: Thin Driver<\/figcaption><\/figure><\/p>\n<p><span style=\"text-decoration: underline;\">Advantages<\/span><\/p>\n<ul>\n<li>The major benefit of using a Type 4 JDBC driver is that they are completely written in Java to achieve platform independence and eliminate deployment administration issues.<\/li>\n<li>No special software is required either on the client or the server side. Further, these drivers can be downloaded dynamically.<\/li>\n<li>The number of translation layers is very less i.e. Type 4 JDBC drivers don&#8217;t have to translate database requests to ODBC or a native connectivity interface or to pass the request on to the another server.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline;\">Disadvantages<\/span><\/p>\n<ul>\n<li>With Type 4 drivers, the user needs a different driver for each database.<\/li>\n<\/ul>\n<h3>1.4 Download Oracle Database<\/h3>\n<p>This Oracle JDBC example requires Oracle Database XE (Express edition) which can be downloaded from the following <a href=\"http:\/\/www.oracle.com\/technetwork\/database\/database-technologies\/express-edition\/downloads\/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">link<\/a>.<\/p>\n<p>Accept the license agreement and download the version for the required platform.<\/p>\n<h3>1.5 Install Oracle Database<\/h3>\n<p>Once the download is complete, just unzip the file and run the <code>setup.exe<\/code> file. Follow the step-by-step installation guide from <a href=\"http:\/\/docs.oracle.com\/cd\/E17781_01\/install.112\/e18803\/toc.htm#BABDDIDI\" target=\"_blank\" rel=\"noopener noreferrer\">this<\/a> link.<\/p>\n<p>Now, open up the Eclipse IDE and let\u2019s start building the application!<\/p>\n<h2>2. JDBC with Oracle Thin Driver Example<\/h2>\n<h3>2.1 Tools Used<\/h3>\n<p>We are using Eclipse Kepler SR2, JDK 8, Oracle Database and Maven. Having said that, we have tested the code against JDK 1.7 and it works well.<\/p>\n<h3>2.2 Project Structure<\/h3>\n<p>Firstly, let\u2019s review the final project structure, in case you are confused about where you should create the corresponding files or folder later!<\/p>\n<p><figure id=\"attachment_48921\" aria-describedby=\"caption-attachment-48921\" style=\"width: 232px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-structure.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48921\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-structure.jpg\" alt=\"Fig. 6: JDBC - Oracle Thin Driver Application Project Structure\" width=\"232\" height=\"289\"><\/a><figcaption id=\"caption-attachment-48921\" class=\"wp-caption-text\">Fig. 6: JDBC &#8211; Oracle Thin Driver Application Project Structure<\/figcaption><\/figure><\/p>\n<h3>2.3 Project Creation<\/h3>\n<p>This section will demonstrate on how to create a Java Maven project with Eclipse. In Eclipse IDE, go to <code>File -&gt; New -&gt; Maven Project<\/code>.<\/p>\n<p><figure id=\"attachment_48923\" aria-describedby=\"caption-attachment-48923\" style=\"width: 652px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48923\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-1.jpg\" alt=\"Fig. 7: Create Maven Project\" width=\"652\" height=\"712\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-1.jpg 652w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-1-275x300.jpg 275w\" sizes=\"(max-width: 652px) 100vw, 652px\" \/><\/a><figcaption id=\"caption-attachment-48923\" class=\"wp-caption-text\">Fig. 7: Create Maven Project<\/figcaption><\/figure><\/p>\n<p>In the New Maven Project window, it will ask you to select a project location. By default, &#8216;<em>Use default workspace location<\/em>&#8216; will be selected. Select the &#8216;<em>Create a simple project (skip archetype selection)<\/em>&#8216; checkbox and just click on next button to proceed.<\/p>\n<p><figure id=\"attachment_48924\" aria-describedby=\"caption-attachment-48924\" style=\"width: 804px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48924\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-2.jpg\" alt=\"Fig. 8: Project Details\" width=\"804\" height=\"541\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-2.jpg 804w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-2-300x202.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-2-768x517.jpg 768w\" sizes=\"(max-width: 804px) 100vw, 804px\" \/><\/a><figcaption id=\"caption-attachment-48924\" class=\"wp-caption-text\">Fig. 8: Project Details<\/figcaption><\/figure><\/p>\n<p>It will ask you to &#8216;Enter a group id for the artifact.&#8217; We will input the details as shown in the below image. The version number will be by default <code>0.0.1-SNAPSHOT<\/code>.<\/p>\n<p><figure id=\"attachment_48925\" aria-describedby=\"caption-attachment-48925\" style=\"width: 598px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-3.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48925\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-3.jpg\" alt=\"Fig. 9: Archetype Parameters\" width=\"598\" height=\"543\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-3.jpg 598w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-3-300x272.jpg 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><figcaption id=\"caption-attachment-48925\" class=\"wp-caption-text\">Fig. 9: Archetype Parameters<\/figcaption><\/figure><\/p>\n<p>Click on Finish and the creation of a maven project will be completed. If you observe, it has downloaded the maven dependencies and a <code>pom.xml<\/code> file will be created. It will have the following code:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;groupId&gt;JdbcOdbc&lt;\/groupId&gt;\n\t&lt;artifactId&gt;JdbcOdbc&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n&lt;\/project&gt;\n<\/pre>\n<p>We can start adding the dependencies that developers want like Oracle etc. Let\u2019s start building the application![ulp id=&#8217;TD36VgQCKfhTAygK&#8217;]<\/p>\n<h2>3. Application Building<\/h2>\n<p>Below are the steps involved in developing this application.<\/p>\n<h3>3.1 SQL Table Creation<\/h3>\n<p>This tutorial uses a table called <code>employee<\/code>. The table is not included when you create the project in eclipse so you need to first create the table to follow this tutorial:<\/p>\n<ul>\n<li>Create the table <code>employee<\/code> as shown below:<\/li>\n<\/ul>\n<pre class=\"brush:sql; wrap-lines:false;\">CREATE TABLE employee(emp_id number NOT NULL, emp_name varchar2(200) NOT NULL, emp_salary number NOT NULL);\n<\/pre>\n<ul>\n<li>Now we shall insert some values into the <code>employee<\/code> table as:<\/li>\n<\/ul>\n<pre class=\"&quot;brush:sql;\">INSERT INTO employee(emp_id, emp_name, emp_salary) VALUES(101, 'Java Code Geek', 10000);\n\nINSERT INTO employee(emp_id, emp_name, emp_salary) VALUES(102, 'Harry Potter', 5000);\n\nINSERT INTO employee(emp_id, emp_name, emp_salary) VALUES(103, 'Lucifer', 2500);\n<\/pre>\n<p>If everything goes well, the table will be shown as below in the Oracle workbench:<\/p>\n<p><figure id=\"attachment_48926\" aria-describedby=\"caption-attachment-48926\" style=\"width: 781px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-database-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48926\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-database-1.jpg\" alt=\"Fig. 10: Table Creation\" width=\"781\" height=\"734\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-database-1.jpg 781w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-database-1-300x282.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-database-1-768x722.jpg 768w\" sizes=\"(max-width: 781px) 100vw, 781px\" \/><\/a><figcaption id=\"caption-attachment-48926\" class=\"wp-caption-text\">Fig. 10: Table Creation<\/figcaption><\/figure><\/p>\n<h3>3.2 Maven Dependencies<\/h3>\n<p>In this example, we are using latest ODBC version (i.e. <code>ojdbc14-10.2.0.3.0<\/code>) in order to make the database connectivity. The <strong>updated<\/strong> file will have the following code:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n\txsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\t&lt;groupId&gt;JdbcOdbc&lt;\/groupId&gt;\n\t&lt;artifactId&gt;JdbcOdbc&lt;\/artifactId&gt;\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\n\t&lt;packaging&gt;jar&lt;\/packaging&gt;\n\t&lt;dependencies&gt;\n\t\t&lt;dependency&gt;\n\t\t\t&lt;groupId&gt;com.oracle&lt;\/groupId&gt;\n\t\t\t&lt;artifactId&gt;ojdbc14&lt;\/artifactId&gt;\n\t\t\t&lt;version&gt;10.2.0.3.0&lt;\/version&gt;\n\t\t&lt;\/dependency&gt;\n\t&lt;\/dependencies&gt;\n\t&lt;build&gt;\n\t\t&lt;finalName&gt;${project.artifactId}&lt;\/finalName&gt;\n\t&lt;\/build&gt;\n&lt;\/project&gt;\n&lt;\/project&gt;\n<\/pre>\n<h3>3.3 Java Class Creation<\/h3>\n<p>Let\u2019s create the required Java files. Right click on <code>src\/main\/java<\/code> folder, <code>New -&gt; Package<\/code>.<\/p>\n<p><figure id=\"attachment_48927\" aria-describedby=\"caption-attachment-48927\" style=\"width: 653px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-4.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48927\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-4.jpg\" alt=\"Fig. 11: Java Package Creation\" width=\"653\" height=\"658\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-4.jpg 653w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-4-150x150.jpg 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-4-298x300.jpg 298w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-4-70x70.jpg 70w\" sizes=\"(max-width: 653px) 100vw, 653px\" \/><\/a><figcaption id=\"caption-attachment-48927\" class=\"wp-caption-text\">Fig. 11: Java Package Creation<\/figcaption><\/figure><\/p>\n<p>A new pop window will open where we will enter the package name as: <code>com.jcg.jdbc.odbc.example<\/code>.<\/p>\n<p><figure id=\"attachment_48928\" aria-describedby=\"caption-attachment-48928\" style=\"width: 520px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-5.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48928\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-5.jpg\" alt=\"Fig. 12: Java Package Name (com.jcg.jdbc.odbc.example)\" width=\"520\" height=\"427\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-5.jpg 520w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-5-300x246.jpg 300w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><\/a><figcaption id=\"caption-attachment-48928\" class=\"wp-caption-text\">Fig. 12: Java Package Name (com.jcg.jdbc.odbc.example)<\/figcaption><\/figure><\/p>\n<p>Once the package is created, we will need to create the implementation class. Right click on the newly created package, <code>New -&gt; Class<\/code>.<\/p>\n<p><figure id=\"attachment_48929\" aria-describedby=\"caption-attachment-48929\" style=\"width: 754px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-6.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48929\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-6.jpg\" alt=\"Fig. 13: Java Class Creation\" width=\"754\" height=\"658\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-6.jpg 754w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-6-300x262.jpg 300w\" sizes=\"(max-width: 754px) 100vw, 754px\" \/><\/a><figcaption id=\"caption-attachment-48929\" class=\"wp-caption-text\">Fig. 13: Java Class Creation<\/figcaption><\/figure><\/p>\n<p>A new pop window will open and enter the file name as: <code>OracleJdbcExample<\/code>. The implementation class will be created inside the package: <code>com.jcg.jdbc.odbc.example<\/code>.<\/p>\n<p><figure id=\"attachment_48930\" aria-describedby=\"caption-attachment-48930\" style=\"width: 534px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-7.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48930\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-7.jpg\" alt=\"Fig. 14: Java Class (OracleJdbcExample.java)\" width=\"534\" height=\"630\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-7.jpg 534w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-guide-7-254x300.jpg 254w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><\/a><figcaption id=\"caption-attachment-48930\" class=\"wp-caption-text\">Fig. 14: Java Class (OracleJdbcExample.java)<\/figcaption><\/figure><\/p>\n<h4>3.2.1 Implementation of Main Class<\/h4>\n<p>In this class, we will be establishing a connection to the database using JDBC API. We need to perform the following steps,<\/p>\n<ul>\n<li>Import the required interfaces or classes from the <code>java.sql<\/code> package.<\/li>\n<li>Load the JDBC Oracle Driver class.<\/li>\n<li>Establish the connection by providing the JDBC Oracle Connection String URL.<\/li>\n<\/ul>\n<p>Add the following code to it:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>OracleJdbcExample.java<\/em><\/span><\/p>\n<pre class=\"brush:java; wrap-lines:false;\"> \npackage com.jcg.jdbc.odbc.example;\n\nimport java.sql.Connection;\nimport java.sql.DriverManager;\nimport java.sql.ResultSet;\nimport java.sql.Statement;\n\npublic class OracleJdbcExample implements DbConstants {\n\n\tstatic Statement stmtObj;\n\tstatic Connection connObj;\n\tstatic ResultSet resultSetObj;\n\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\t\/\/ Step 1 - Register Oracle JDBC Driver (Though This Is No Longer Required Since JDBC 4.0, But Added Here For Backward Compatibility!\n\t\t\tClass.forName(\"oracle.jdbc.driver.OracleDriver\");\n\n\t\t\t\/\/ Step 2 - Creating Oracle Connection Object\n\t\t\tconnObj = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);  \n\t\t\tif(connObj != null) {\n\t\t\t\tSystem.out.println(\"!! Connected With Oracle Database !!\\n\");\n\t\t\t}\n\n\t\t\t\/\/ Step 3 - Creating Oracle Statement Object\n\t\t\tstmtObj = connObj.createStatement();\n\n\t\t\t\/\/ Step 4 - Execute SQL Query\n\t\t\tresultSetObj = stmtObj.executeQuery(\"SELECT * FROM employee\");\n\t\t\twhile(resultSetObj.next()) {\t\t\t\n\t\t\t\tSystem.out.println(resultSetObj.getInt(1) + \", \" + resultSetObj.getString(2) + \", \" + resultSetObj.getFloat(3) + \"$\");\n\t\t\t}\n\t\t} catch(Exception sqlException) {\n\t\t\tsqlException.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif(resultSetObj != null) {\n\t\t\t\t\tresultSetObj.close();\n\t\t\t\t}\n\t\t\t\tif(stmtObj != null) {\n\t\t\t\t\tstmtObj.close();\n\t\t\t\t}\n\t\t\t\tif(connObj != null) {\n\t\t\t\t\tconnObj.close();\n\t\t\t\t}\n\t\t\t} catch(Exception sqlException) {\n\t\t\t\tsqlException.printStackTrace();\n\t\t\t}\n\t\t}\n\t}\n}\n<\/pre>\n<h2>4. Run the Application<\/h2>\n<p>To run the application, Right click on the <code>OracleJdbcExample<\/code> class, <code>Run As -&gt; Java Application<\/code>.<\/p>\n<p><figure id=\"attachment_48931\" aria-describedby=\"caption-attachment-48931\" style=\"width: 849px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-deploy-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48931\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-deploy-1.jpg\" alt=\"Fig. 15: Run Application\" width=\"849\" height=\"670\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-deploy-1.jpg 849w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-deploy-1-300x237.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-deploy-1-768x606.jpg 768w\" sizes=\"(max-width: 849px) 100vw, 849px\" \/><\/a><figcaption id=\"caption-attachment-48931\" class=\"wp-caption-text\">Fig. 15: Run Application<\/figcaption><\/figure><\/p>\n<h2>5. Project Demo<\/h2>\n<p>The code shows the following status as output:<\/p>\n<p><figure id=\"attachment_48932\" aria-describedby=\"caption-attachment-48932\" style=\"width: 849px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-demo-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48932\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-demo-1.jpg\" alt=\"Fig. 16: Application Output\" width=\"849\" height=\"66\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-demo-1.jpg 849w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-demo-1-300x23.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/jdbc-odbc-example-project-demo-1-768x60.jpg 768w\" sizes=\"(max-width: 849px) 100vw, 849px\" \/><\/a><figcaption id=\"caption-attachment-48932\" class=\"wp-caption-text\">Fig. 16: Application Output<\/figcaption><\/figure><\/p>\n<p>That\u2019s all for this post. Happy Learning!!<\/p>\n<h2>6. Conclusion<\/h2>\n<p>Here, in this example, we have seen how to connect to the Oracle database using JDBC Thin Driver. With Thin Driver, it is much easier to connect to the database as developers don\u2019t need to create the data-sources like they used to do while using a JDBC ODBC Driver.<\/p>\n<h2>7. Download the Eclipse Project<\/h2>\n<p>This was an example of Java Application with Oracle database.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/08\/Jdbc-Odbc.zip\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Jdbc Odbc<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Java Database Connectivity (JDBC) is a Java-based data access technology that defines how a client may access a database. It provides methods for querying and updating the data in a database. The JDBC classes are contained in the Java package i.e. java.sql and javax.sql. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1. Introduction In &hellip;<\/p>\n","protected":false},"author":119,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[216],"class_list":["post-48914","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","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 with Oracle Thin Driver Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle database.\" \/>\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-oracle-thin-driver-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JDBC with Oracle Thin Driver Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle database.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-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=\"2017-08-03T08:00:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-05T11:04:17+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=\"Yatin\" \/>\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=\"Yatin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 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-oracle-thin-driver-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/\"},\"author\":{\"name\":\"Yatin\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13\"},\"headline\":\"JDBC with Oracle Thin Driver Example\",\"datePublished\":\"2017-08-03T08:00:34+00:00\",\"dateModified\":\"2019-03-05T11:04:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/\"},\"wordCount\":1651,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"jdbc\"],\"articleSection\":[\"sql\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/\",\"name\":\"JDBC with Oracle Thin Driver Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2017-08-03T08:00:34+00:00\",\"dateModified\":\"2019-03-05T11:04:17+00:00\",\"description\":\"In this example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle database.\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-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-oracle-thin-driver-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 with Oracle Thin Driver 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\/9874407a37b028e8be3276e2b5960d13\",\"name\":\"Yatin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg\",\"caption\":\"Yatin\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/yatin-batra\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JDBC with Oracle Thin Driver Example - Java Code Geeks","description":"In this example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle database.","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-oracle-thin-driver-example\/","og_locale":"en_US","og_type":"article","og_title":"JDBC with Oracle Thin Driver Example - Java Code Geeks","og_description":"In this example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle database.","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-08-03T08:00:34+00:00","article_modified_time":"2019-03-05T11:04:17+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":"Yatin","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/"},"author":{"name":"Yatin","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/9874407a37b028e8be3276e2b5960d13"},"headline":"JDBC with Oracle Thin Driver Example","datePublished":"2017-08-03T08:00:34+00:00","dateModified":"2019-03-05T11:04:17+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/"},"wordCount":1651,"commentCount":4,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["jdbc"],"articleSection":["sql"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/","name":"JDBC with Oracle Thin Driver Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2017-08-03T08:00:34+00:00","dateModified":"2019-03-05T11:04:17+00:00","description":"In this example, we will see how to setup a JDBC environment and create a simple Java database application to connect to Oracle database.","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/sql\/jdbc-oracle-thin-driver-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-oracle-thin-driver-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 with Oracle Thin Driver 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\/9874407a37b028e8be3276e2b5960d13","name":"Yatin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2023\/09\/cropped-Yatin-Batra_avatar_1515758148-96x96.jpg","caption":"Yatin"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/yatin-batra\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/48914","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\/119"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=48914"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/48914\/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=48914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=48914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=48914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}