I’m using Oracle 18c Express edition and trying to connect to the same using the below code.
DriverManager.getConnection("jdbc:oracle:thin://@localhost:1521/XE", "system", "Root123");
And upon execution, there’s an exception:
java.sql.SQLException: Invalid Oracle URL specified
I am unable to figure out what’s wrong with the URL. Kindly help resolve this issue. TIA.
According to Oracle’s documentation the URL should be:
Where user and password can be provided as connection properties:
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@myhost:1521:orcl", "scott", "tiger");
You probably need to remove the
// from the URL as well: