{"id":17099,"date":"2022-02-02T11:09:39","date_gmt":"2022-02-02T10:09:39","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/"},"modified":"2022-02-02T11:09:39","modified_gmt":"2022-02-02T10:09:39","slug":"ords-with-tns","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/","title":{"rendered":"ORDS with TNS"},"content":{"rendered":"<p>The aim of that blog is to look into <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest.html\" target=\"_blank\" rel=\"noopener\">Oracle REST Data Services (ORDS)<\/a> DB connection with TNS. This is following some experience at a customer who wanted to move to latest version of ORDS with APEX 21.2, in late 2021, and run into an issue.<br \/>\n<!--more--><br \/>\nFor general presentation about ORDS installation please see the <a href=\"https:\/\/www.dbi-services.com\/blog\/oracle-rest-data-services-installation-and-configuration\/\" target=\"_blank\" rel=\"noopener\">blog<\/a> of my colleague <a href=\"https:\/\/www.dbi-services.com\/blog\/author\/lazhar-felahi\/\" target=\"_blank\" rel=\"noopener\">Lazhar Felahi<\/a> on that topic.<br \/>\n&nbsp;<br \/>\nDuring installation or upgrade of ORDS you have to select the DB connection mode between following values:<\/p>\n<pre class=\"brush: text; gutter: true; first-line: 1\">\nSpecify the database connection type to use.\nEnter number for [1] Basic [2] TNS [3] Custom URL [1]:\n<\/pre>\n<p>If you are using DataGuard or RAC, you will have to choose the TNS option [2] in order to benefit from the DB features in terms of availability. I would even recommend to use TNS as general rule, as this is mostly defined and provided by your DBA for connecting your client to the DB.<br \/>\nTo make use of TNS you have to provide the service name (TNS Network Alias) and the location of your tnsnames.ora file (TNS folder location) during the setup process.<br \/>\nUntil version <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads-2113.html\" rel=\"noopener\" target=\"_blank\">21.1.3<\/a> of ORDS that feature was working nicely.<br \/>\nUnfortunately, starting with version <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads-212.html\" rel=\"noopener\" target=\"_blank\">21.2<\/a> some error is raised when trying to update or newly install ORDS with DB connection over TNS, at the time the connection is used.<\/p>\n<pre class=\"brush: text; gutter: true; first-line: 1 highlight: [1,2,4,5,8,9]\">\noracle.net.resolver.EZConnectResolver.parseExtendedProperties Extended settings parsing failed.\n java.lang.RuntimeException: Invalid character at 24 : \n...\noracle.dbtools.common.logging.JDKLogSink.record IO Error: Invalid connection string format, \na valid format is: \"host:port:sid\" (CONNECTION_ID=X8ADepYuRpK1p8FSAKp41Q==),|apex||...,\njdbc:oracle:thin:@myDB?TNS_ADMIN=D:AppOracletns\n...\noracle.dbtools.common.logging.JDKLogSink.record The pool named: |apex|| is invalid and will be ignored: \nORDS was unable to make a connection to the database. \nThis can occur if the database is unavailable, the maximum number of sessions has been reached\nor the pool is not correctly configured. The connection pool named: |apex|| had the following error(s): \nIO Error: Invalid connection string format, a valid format is: \"host:port:sid\"\n...\n<\/pre>\n<p>That issue is still present in versions <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads-2124.html\" rel=\"noopener\" target=\"_blank\">21.2.4<\/a>, <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads-213.html\" rel=\"noopener\" target=\"_blank\">21.3<\/a>, <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads-2131.html\" rel=\"noopener\" target=\"_blank\">21.3.1<\/a> and <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads-21.4.html\" rel=\"noopener\" target=\"_blank\">21.4<\/a><br \/>\nIt was reported to Oracle by opening and SR with the support, by my customer, and a bug was registered: Bug 33583853 &#8211; FAILED TO CONNECT TO USER: ORDS_PUBLIC_USER URL: JDBC:ORACLE:THIN:@MYDB?TNS_ADMIN<br \/>\nFortunately, there is a workaround in using the option [3] Custom URL, until the bug fix is implemented.<br \/>\nWhen you make use of that option, you have to build your own Java connection string which looks as following:<\/p>\n<pre class=\"brush: text; gutter: false; first-line: 1\">\njdbc:oracle:thin:@MY_TNS_ALIAS?TNS_ADMIN=D:\\Oracle\\tns\\admin\n<\/pre>\n<p>Where MY_TNS_ALIAS is the alias defined in your tnsnames.ora file and D:\\Oracle\\tns\\admin is the path to your tnsnames.ora file (in this case on a Windows server so the &#8221; needs to be doubled). This is working fine on all previously listed ORDS versions.<br \/>\nYou can have a look into <a href=\"https:\/\/community.oracle.com\/tech\/developers\/discussion\/4490692\/ords-with-tns-error-when-trying-to-connect-db-for-apex\" rel=\"noopener\" target=\"_blank\">Oracle Community Discussion<\/a> for details on the testing and the solution.<br \/>\nAccording to Jeff Smith the bug resolution is provided &#8220;&#8230;before the Groundhog gets his day in PA.&#8221; which is today, February 2nd.<br \/>\nVersion <a href=\"https:\/\/www.oracle.com\/database\/technologies\/appdev\/rest-data-services-downloads.html\" rel=\"noopener\" target=\"_blank\">21.4.1<\/a> was released.<br \/>\nAfter testing, I can confirm that this release is fixing the issue and behavior is back to normal. Thanks Oracle for the fix.<br \/>\nSpecial thanks to <a href=\"https:\/\/www.thatjeffsmith.com\/about\/\" rel=\"noopener\" target=\"_blank\">Jeff Smith<\/a>, the Oracle product manager of ORDS, for the clarifications given and the follow-up on the bug resolution.<br \/>\n&nbsp;<br \/>\nSo if you want to use TNS without the Custom URL, <strong>stay on ORDS version prior to 21.2 or move to version 21.4.1<\/strong>.<br \/>\nI hope that blog will be helpful, if you run into similar issue. Enjoy ORDS.<\/p>\n<p><strong>Note:<\/strong> If you are looking for details about licencing please have look into that <a href=\"https:\/\/www.thatjeffsmith.com\/archive\/2019\/04\/oracle-sql-developer-and-the-oracle-jdk-in-2019\/\" rel=\"noopener\" target=\"_blank\">blog<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The aim of that blog is to look into Oracle REST Data Services (ORDS) DB connection with TNS. This is following some experience at a customer who wanted to move to latest version of ORDS with APEX 21.2, in late 2021, and run into an issue.<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197,59],"tags":[1545,1352,2470],"type_dbi":[],"class_list":["post-17099","post","type-post","status-publish","format-standard","hentry","category-application-integration-middleware","category-oracle","tag-error","tag-ords","tag-tns"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>ORDS with TNS - dbi Blog<\/title>\n<meta name=\"description\" content=\"ORDS with TNS connection to DB. What if Invalid character and Invalid connection string error? Workaround and solution. Versions 21.2 to 21.4\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ORDS with TNS\" \/>\n<meta property=\"og:description\" content=\"ORDS with TNS connection to DB. What if Invalid character and Invalid connection string error? Workaround and solution. Versions 21.2 to 21.4\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-02T10:09:39+00:00\" \/>\n<meta name=\"author\" content=\"Alain Lacour\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alain Lacour\" \/>\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:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\"},\"author\":{\"name\":\"Alain Lacour\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/acabba2b6ca473b44b098c2de61294b0\"},\"headline\":\"ORDS with TNS\",\"datePublished\":\"2022-02-02T10:09:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\"},\"wordCount\":474,\"commentCount\":0,\"keywords\":[\"Error\",\"ORDS\",\"TNS\"],\"articleSection\":[\"Application integration &amp; Middleware\",\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\",\"name\":\"ORDS with TNS - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2022-02-02T10:09:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/acabba2b6ca473b44b098c2de61294b0\"},\"description\":\"ORDS with TNS connection to DB. What if Invalid character and Invalid connection string error? Workaround and solution. Versions 21.2 to 21.4\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ORDS with TNS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/acabba2b6ca473b44b098c2de61294b0\",\"name\":\"Alain Lacour\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/455c4c7743e192ae868a6f9e6ed875415c5887567577eccbbbf2d65012cd976a?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/455c4c7743e192ae868a6f9e6ed875415c5887567577eccbbbf2d65012cd976a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/455c4c7743e192ae868a6f9e6ed875415c5887567577eccbbbf2d65012cd976a?s=96&d=mm&r=g\",\"caption\":\"Alain Lacour\"},\"description\":\"Alain Lacour has more than 15 years of experience in application development with Oracle technologies. He is specialized in APEX, Java, and PL\/SQL development. His expertise also includes middleware technologies such as Oracle Weblogic and EMC Documentum. He also has a broad experience in business analysis and architecture solutions as well as in service and project management. Prior to dbi services, Alain Lacour was Senior Consultant at IMS Health in Basel. He also worked as a Software Engineer for M&amp;H Informatics in Basel. Alain Lacour holds a Master of Science in Industrial Computing from the University of Mulhouse (F). His branch-related experience mainly covers the pharma industry, with an in-depth knowledge of the drug development process as well as drug distribution.\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/alain-lacour\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"ORDS with TNS - dbi Blog","description":"ORDS with TNS connection to DB. What if Invalid character and Invalid connection string error? Workaround and solution. Versions 21.2 to 21.4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/","og_locale":"en_US","og_type":"article","og_title":"ORDS with TNS","og_description":"ORDS with TNS connection to DB. What if Invalid character and Invalid connection string error? Workaround and solution. Versions 21.2 to 21.4","og_url":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/","og_site_name":"dbi Blog","article_published_time":"2022-02-02T10:09:39+00:00","author":"Alain Lacour","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alain Lacour","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/"},"author":{"name":"Alain Lacour","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/acabba2b6ca473b44b098c2de61294b0"},"headline":"ORDS with TNS","datePublished":"2022-02-02T10:09:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/"},"wordCount":474,"commentCount":0,"keywords":["Error","ORDS","TNS"],"articleSection":["Application integration &amp; Middleware","Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/","url":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/","name":"ORDS with TNS - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2022-02-02T10:09:39+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/acabba2b6ca473b44b098c2de61294b0"},"description":"ORDS with TNS connection to DB. What if Invalid character and Invalid connection string error? Workaround and solution. Versions 21.2 to 21.4","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/ords-with-tns\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"ORDS with TNS"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/acabba2b6ca473b44b098c2de61294b0","name":"Alain Lacour","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/455c4c7743e192ae868a6f9e6ed875415c5887567577eccbbbf2d65012cd976a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/455c4c7743e192ae868a6f9e6ed875415c5887567577eccbbbf2d65012cd976a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/455c4c7743e192ae868a6f9e6ed875415c5887567577eccbbbf2d65012cd976a?s=96&d=mm&r=g","caption":"Alain Lacour"},"description":"Alain Lacour has more than 15 years of experience in application development with Oracle technologies. He is specialized in APEX, Java, and PL\/SQL development. His expertise also includes middleware technologies such as Oracle Weblogic and EMC Documentum. He also has a broad experience in business analysis and architecture solutions as well as in service and project management. Prior to dbi services, Alain Lacour was Senior Consultant at IMS Health in Basel. He also worked as a Software Engineer for M&amp;H Informatics in Basel. Alain Lacour holds a Master of Science in Industrial Computing from the University of Mulhouse (F). His branch-related experience mainly covers the pharma industry, with an in-depth knowledge of the drug development process as well as drug distribution.","url":"https:\/\/www.dbi-services.com\/blog\/author\/alain-lacour\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=17099"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17099\/revisions"}],"predecessor-version":[{"id":29024,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/17099\/revisions\/29024"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=17099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=17099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=17099"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=17099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}