{"id":1501,"date":"2017-05-06T22:34:23","date_gmt":"2017-05-06T22:34:23","guid":{"rendered":"http:\/\/nenadnoveljic.com\/blog\/?p=1501"},"modified":"2021-05-01T14:58:59","modified_gmt":"2021-05-01T14:58:59","slug":"oracle-jdbc-security","status":"publish","type":"post","link":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/","title":{"rendered":"Oracle JDBC Security"},"content":{"rendered":"<h1>ALLOWED_LOGON_VERSION_SERVER<\/h1>\n<p>The default behavior of Oracle database is to support connections coming from Oracle clients with lower, less secure versions of the authentication protocol. Since the negotiation process is seamless, there is no alert for the degradation of security if the database adjusts to a less secure client. There is a sqlnet.ora parameter <a href=\"https:\/\/docs.oracle.com\/database\/122\/NETRF\/parameters-for-the-sqlnet-ora-file.htm#NETRF2016\" target=\"_blank\" rel=\"noopener noreferrer\">SQLNET.ALLOWED_LOGON_VERSION_SERVER<\/a> to set the minimum authentication protocol allowed when connecting to Oracle Database instances. If the database client doesn&#8217;t support the defined authentication protocol, the error <em>ORA-28040: No matching authentication protocol<\/em> will be returned to the client.<\/p>\n<p>I set different values for the SQLNET.ALLOWED_LOGON_VERSION_SERVER on a 12.2.0.1 database and tested various Oracle clients to find out which versions of the authentication protocols are effectively used by different clients. I repeated the tests for JDBC and instant clients and was surprised to find out that JDBC uses sometimes less secure authentication protocols than the regular and instant clients of the same version.<\/p>\n<h1>JDBC<\/h1>\n<p>If you would like to test for yourself I&#8217;m providing the java class saved in ConnectDB.java:<\/p>\n<pre><code>import java.sql.DriverManager;\nimport java.sql.Connection;\nimport java.sql.SQLException;\n\npublic class ConnectDB {\n    public static void main(String[] argv) {\n        try {\n            Class.forName(\"oracle.jdbc.driver.OracleDriver\");\n        } catch (ClassNotFoundException e) {\n            e.printStackTrace();\n            return;\n        }\n\n\ttry {\n            connection = DriverManager.getConnection(\n                \"jdbc:oracle:thin:@localhost:1521:DB\", \"user\", \"password\");\n        } catch (SQLException e) {\n            e.printStackTrace();\n            return;\n        }\n    }\n}<\/code><\/pre>\n<p>Compile the class with the following command:<\/p>\n<pre><code>javac ConnectDB.java<\/code><\/pre>\n<p>And run it like this:<\/p>\n<pre><code>java  -cp .:.\/ojdbc7.jar ConnectDB<\/code><\/pre>\n<h1>Test Results<\/h1>\n<p>The following table provides an overview of the authentication protocol versions supported by various Oracle clients:<br \/>\n\n<table id=\"tablepress-3\" class=\"tablepress tablepress-id-3\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Client Version<\/th><th class=\"column-2\">Type<\/th><th class=\"column-3\">Protocol Version<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">12.2.0.1<\/td><td class=\"column-2\">regular<\/td><td class=\"column-3\">12a<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">12.2.0.1<\/td><td class=\"column-2\">instant<\/td><td class=\"column-3\">12a<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">12.2.0.1<\/td><td class=\"column-2\">JDBC<\/td><td class=\"column-3\">12a<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">12.1.0.2<\/td><td class=\"column-2\">regular<\/td><td class=\"column-3\">12a<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">12.1.0.2<\/td><td class=\"column-2\">instant<\/td><td class=\"column-3\">12a<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">12.1.0.2<\/td><td class=\"column-2\">JDBC<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-8\">\n\t<td class=\"column-1\">12.1.0.1<\/td><td class=\"column-2\">regular<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-9\">\n\t<td class=\"column-1\">12.1.0.1<\/td><td class=\"column-2\">instant<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-10\">\n\t<td class=\"column-1\">12.1.0.1<\/td><td class=\"column-2\">JDBC<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-11\">\n\t<td class=\"column-1\">11.2.0.4<\/td><td class=\"column-2\">regular<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-12\">\n\t<td class=\"column-1\">11.2.0.4<\/td><td class=\"column-2\">instant<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-13\">\n\t<td class=\"column-1\">11.2.0.4<\/td><td class=\"column-2\">JDBC<\/td><td class=\"column-3\">12<\/td>\n<\/tr>\n<tr class=\"row-14\">\n\t<td class=\"column-1\">10.2.0.5<\/td><td class=\"column-2\">instant<\/td><td class=\"column-3\">11<\/td>\n<\/tr>\n<tr class=\"row-15\">\n\t<td class=\"column-1\">10.2.0.5<\/td><td class=\"column-2\">JDBC<\/td><td class=\"column-3\">8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-3 from cache --><br \/>\nThe JDBC drivers which support lower versions of the authentication protocol than the regular and instant clients of the same version are marked red. Note that the authentication protocol version doesn&#8217;t necessarily correspond to the database version.<\/p>\n<p>Below are some conclusions derived from the table above:<\/p>\n<ul>\n<li>The good news is that the JDBC driver of the currently latest relase 12.2.0.1 support the currently latest version (12a) of the authentication protocol. Therefore, it is best to upgrade all of the clients when you upgrade the database.<\/li>\n<li>Unlike regular and instant client, the JDBC client 12.1.0.2 doesn&#8217;t support 12a version of the authentication protocol.<\/li>\n<li>JDBC client 10.2.0.5 supports only the version 8 of the authentication protocol, whereas the instant client of the same version supports 11.<\/li>\n<\/ul>\n<h1>Upgrades<\/h1>\n<p>The following table shows the default lowest authentication protocol accepted by different database releases .<\/p>\n\n<table id=\"tablepress-4\" class=\"tablepress tablepress-id-4\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Database Version<\/th><th class=\"column-2\">Authentication Protocol Version<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">11.2<\/td><td class=\"column-2\">8<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">12.1<\/td><td class=\"column-2\">11<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">12.2<\/td><td class=\"column-2\">12<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-4 from cache -->\n<p>This means that if you upgrade to 12.1 and have some JDBC 10.2 clients around they&#8217;ll start getting <em>ORA-28040: No matching authentication protocol<\/em> when trying to connect to the database, because by default the database instance will reject connections using the authentication protocol of version 8. In this case, you can set SQLNET.ALLOWED_LOGON_VERSION_SERVER to 8 as a workaround until you replace the old the JDBC drivers with the new ones. For security reasons this should be done as soon as possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version. <a href=\"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[40,5],"tags":[],"class_list":["post-1501","post","type-post","status-publish","format-standard","hentry","category-jdbc","category-oracle"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Oracle JDBC Security - All-round Database Topics<\/title>\n<meta name=\"description\" content=\"Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle JDBC Security - All-round Database Topics\" \/>\n<meta property=\"og:description\" content=\"Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/\" \/>\n<meta property=\"og:site_name\" content=\"All-round Database Topics\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-06T22:34:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-01T14:58:59+00:00\" \/>\n<meta name=\"author\" content=\"Nenad Noveljic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@NenadNoveljic\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nenad Noveljic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/\"},\"author\":{\"name\":\"Nenad Noveljic\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\"},\"headline\":\"Oracle JDBC Security\",\"datePublished\":\"2017-05-06T22:34:23+00:00\",\"dateModified\":\"2021-05-01T14:58:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/\"},\"wordCount\":440,\"commentCount\":1,\"articleSection\":[\"JDBC\",\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/\",\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/\",\"name\":\"Oracle JDBC Security - All-round Database Topics\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-05-06T22:34:23+00:00\",\"dateModified\":\"2021-05-01T14:58:59+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\"},\"description\":\"Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/oracle-jdbc-security\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle JDBC Security\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/\",\"name\":\"All-round Database Topics\",\"description\":\"Nenad Noveljic\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\",\"name\":\"Nenad Noveljic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"caption\":\"Nenad Noveljic\"},\"sameAs\":[\"nenad-noveljic-9b746a6\",\"https:\\\/\\\/x.com\\\/NenadNoveljic\"],\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/author\\\/nenad\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Oracle JDBC Security - All-round Database Topics","description":"Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version.","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:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/","og_locale":"en_US","og_type":"article","og_title":"Oracle JDBC Security - All-round Database Topics","og_description":"Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version.","og_url":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/","og_site_name":"All-round Database Topics","article_published_time":"2017-05-06T22:34:23+00:00","article_modified_time":"2021-05-01T14:58:59+00:00","author":"Nenad Noveljic","twitter_card":"summary_large_image","twitter_creator":"@NenadNoveljic","twitter_misc":{"Written by":"Nenad Noveljic","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/#article","isPartOf":{"@id":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/"},"author":{"name":"Nenad Noveljic","@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa"},"headline":"Oracle JDBC Security","datePublished":"2017-05-06T22:34:23+00:00","dateModified":"2021-05-01T14:58:59+00:00","mainEntityOfPage":{"@id":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/"},"wordCount":440,"commentCount":1,"articleSection":["JDBC","Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/","url":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/","name":"Oracle JDBC Security - All-round Database Topics","isPartOf":{"@id":"https:\/\/nenadnoveljic.com\/blog\/#website"},"datePublished":"2017-05-06T22:34:23+00:00","dateModified":"2021-05-01T14:58:59+00:00","author":{"@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa"},"description":"Some JDBC drivers use lower, less secure authentication protocols than the regular clients of the same version.","breadcrumb":{"@id":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nenadnoveljic.com\/blog\/oracle-jdbc-security\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nenadnoveljic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Oracle JDBC Security"}]},{"@type":"WebSite","@id":"https:\/\/nenadnoveljic.com\/blog\/#website","url":"https:\/\/nenadnoveljic.com\/blog\/","name":"All-round Database Topics","description":"Nenad Noveljic","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nenadnoveljic.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa","name":"Nenad Noveljic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","caption":"Nenad Noveljic"},"sameAs":["nenad-noveljic-9b746a6","https:\/\/x.com\/NenadNoveljic"],"url":"https:\/\/nenadnoveljic.com\/blog\/author\/nenad\/"}]}},"_links":{"self":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/1501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/comments?post=1501"}],"version-history":[{"count":1,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/1501\/revisions"}],"predecessor-version":[{"id":1524,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/1501\/revisions\/1524"}],"wp:attachment":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/media?parent=1501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/categories?post=1501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/tags?post=1501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}