My Oracle Support Banner

JDBC Thin 19c Fails With java.sql.SQLException: Invalid Oracle URL specified When Password Has Hyphen(-) Character (Doc ID 2726070.1)

Last updated on FEBRUARY 10, 2022

Applies to:

JDBC - Version to 19.7 [Release 12c to 18c]
Information in this document applies to any platform.


The connection is established without issues when using JDBC, but fails when the driver is upgraded to JDBC or higher.

Full exception:

Exception in thread "main" java.lang.RuntimeException: Invalid Oracle URL specified
  at com.<NAME>.MyClass.myMethod(<CLASS NAME>.java:130)
  at com.<NAME>.MyClass.main(<CLASS NAME>.java:62)
Caused by: java.sql.SQLException: Invalid Oracle URL specified
  at oracle.jdbc.driver.PhysicalConnection.parseUrl(
  at oracle.jdbc.driver.PhysicalConnection.readConnectionProperties(
  at oracle.jdbc.driver.PhysicalConnection.(
  at oracle.jdbc.driver.T4CConnection.(
  at oracle.jdbc.driver.T4CDriverExtension.getConnection(
  at oracle.jdbc.driver.OracleDriver.connect(
  at oracle.jdbc.driver.OracleDriver.connect(
  at java.sql.DriverManager.getConnection(
  at java.sql.DriverManager.getConnection(


However, connectivity works fine with SQL*Plus 19c to the same database using the same credentials.

Note1:  The special characters allowed in 12c passwords are:  ‘ ~ ! @ # $ % ^ & * ( ) _ - + = { } [ ] \ / < > , . ; ? ' : | (space) 
Note2:  In the above tests, the password contained a hyphen (-) character.




To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.