{"id":21599,"date":"2019-12-07T09:15:37","date_gmt":"2019-12-07T09:15:37","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=21599"},"modified":"2024-08-09T06:33:29","modified_gmt":"2024-08-09T06:33:29","slug":"fix-ora-01017-invalid-username-password-logon-denied","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/fix-ora-01017-invalid-username-password-logon-denied\/","title":{"rendered":"Fix ORA-01017: invalid username\/password Error"},"content":{"rendered":"<h1>Fix ORA-01017: invalid username\/password Error<\/h1>\n<p>Let&#8217;s fix ORA-01017: invalid username\/password; logon denied error while connecting to Oracle database from JDBC program.<\/p>\n<h2>Error trace<\/h2>\n<p>Exception in thread &#8220;main&#8221; java.sql.SQLException: ORA-01017: invalid username\/password; logon denied<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21602\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/ORA-01017-invalid-username-password.png\" alt=\"ORA 01017 invalid username password\" width=\"1920\" height=\"1080\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/ORA-01017-invalid-username-password.png 1920w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/ORA-01017-invalid-username-password-300x169.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/ORA-01017-invalid-username-password-1024x576.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/ORA-01017-invalid-username-password-768x432.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/ORA-01017-invalid-username-password-1536x864.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h2>Fix<\/h2>\n<h3>Check user credentials<\/h3>\n<p>The error is generic and there could multiple causes for the error. First things first, cross check the username and password of the database user credentials.<\/p>\n<ul>\n<li>Check if username is correct.<\/li>\n<li>Check if the password is correct.<\/li>\n<\/ul>\n<h3>Connection descriptor<\/h3>\n<p>Check the connection descriptor used in the Java program. The database that we try to connect should have the schema specified in the connection descriptor.<\/p>\n<p>For example:<\/p>\n<p><em>jdbc:oracle:thin:scott\/tiger@\/\/localhost:1521\/orcl.localdomain<\/em><\/p>\n<p>In the above descriptor we are trying to connect to the root CDB container database as SCOTT user. Oracle no longer ships the SCOTT schema with container root starter database.<\/p>\n<p>Thin Service Name Syntax:<\/p>\n<p><em>&#8220;jdbc:oracle:thin:&lt;username&gt;\/&lt;password&gt;@\/\/&lt;hostname&gt;:&lt;port&gt;\/&lt;servicename&gt;&#8221;;<\/em><\/p>\n<p>This is most common error where we create the user in pluggable database(PDB). To fix this change the service name in the connection descriptor. For example,<\/p>\n<p><em>jdbc:oracle:thin:scott\/tiger@\/\/localhost:1521\/orclpdb.localdomain<\/em><\/p>\n<p>We can get the details of the service name in the tnsnames.ora file on the database instance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21596\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/tnsnames-File-Oracle-TestingDocs.png\" alt=\"tnsnames File Oracle TestingDocs\" width=\"1920\" height=\"1072\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/tnsnames-File-Oracle-TestingDocs.png 1920w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/tnsnames-File-Oracle-TestingDocs-300x168.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/tnsnames-File-Oracle-TestingDocs-1024x572.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/tnsnames-File-Oracle-TestingDocs-768x429.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/tnsnames-File-Oracle-TestingDocs-1536x858.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Try changes these things and modify the program and try connecting to the database.<\/p>\n<p>That&#8217;s it. This should resolve the database connection issue from the Java program.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fix ORA-01017: invalid username\/password Error Let&#8217;s fix ORA-01017: invalid username\/password; logon denied error while connecting to Oracle database from JDBC program. Error trace Exception in thread &#8220;main&#8221; java.sql.SQLException: ORA-01017: invalid username\/password; logon denied &nbsp; Fix Check user credentials The error is generic and there could multiple causes for the error. First things first, cross check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"class_list":["post-21599","post","type-post","status-publish","format-standard","hentry","category-java","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/21599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=21599"}],"version-history":[{"count":12,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/21599\/revisions"}],"predecessor-version":[{"id":23685,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/21599\/revisions\/23685"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=21599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=21599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=21599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}