Invalid Oracle URL specified: OracleDataSource.makeURL

I'm trying to connect to a local oracle database but I'm getting this cryptic error message: Invalid Oracle URL specified: OracleDataSource.makeURL.

I'm pretty sure this is due to an error with the database connection parameters I'm passing, but really, this error message does not help me in any way. Any hints as to what I'm doing wrong would be greatly appreciated.

FYI: Code used to connect is below, except for the hardcoded strings this is what is used on our production environment and does work there.

OracleDataSource dataSource = new OracleDataSource();
 dataSource.setServerName("localhost");
 dataSource.setUser(userName);
 dataSource.setPassword(password);
 dataSource.setDatabaseName("orcl");
return dataSource.getConnection();

Surprisingly, after adding the following two lines to the code which created the connection, it worked.

dataSource.setPortNumber(1521);
dataSource.setDriverType("thin");

I don't understand why we did not have that problem before, but that may have something to do with my local install. My biggest beef is with the error message not giving any detail about what is wrong though.

getting error Invalid Oracle URL specified: OracleDataSource , Cause: Connection could not be allocated because: Invalid Oracle URL specified​: OracleDataSource.makeURL Error Code: 0 at org.eclipse  Invalid Oracle URL specified: OracleDataSource.makeURL in Arquillian ITest 0 Spring boot oracle connection Invalid Oracle URL specified: OracleDataSource.makeURL

if you use setUrl (or if your container like glassfish does it)

make sure you use correct syntax

==== Notice the colon before @ ====

jdbc:oracle:thin:@localhost:1521:sid

or

jdbc:oracle:thin:@localhost:1521/servicename

The datasource class tries to parse it and gives cryptic error if syntax has issues

Exception java.sql.SQLException: Invalid Oracle URL specified , SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL when trying to use an non-XA Oracle datasource. Solution Verified -  Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more invalid Oracle URL specified: OracleDataSource.makeURL (WAS 8.5)

For WildFly users (v14.0.1.Final currently).

You need to add additional parameters for DataSource:

DataSource -> Connection -> Connection Properties

driverType=thin (press Enter to complite).

Also doublecheck you use right type of DataSource. In my case problem was solved by creating XA DataSource and pass URL to parameter.

Java.sql.SQLException: Invalid Oracle URL Specified, SQLException: Invalid Oracle URL Specified: OracleDataSource.makeURL (Doc ID 2126493.1). Last updated on MARCH 29, 2019. Applies to: Oracle Access  Oracle JDBC - java.sql.SQLException: invalid Oracle-URL : OracleDataSource.makeURL Posted on Apr 14, 2016 at 03:03 PM | 299 Views

Invalid Oracle URL specified: OracleDataSource.makeURL, JDBC Adapters Connection setup error: "Invalid Oracle URL specified: OracleDataSource.makeURL". Jun 8, 2018 by WebMethods Newbie. I'll be using Oracle  I asked this on Stackoverflow but haven't received any feedback. oracle11g - Invalid Oracle URL specified: OracleDataSource.makeURL in Arquillian ITest - Stack Overflow I'm hoping for a response here.

Need help. I am unable to get past this error while configuring and , You are not specifying a "URL" property, refer to the docs here for an example of SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL. java.sql.SQLException: Invalid Oracle URL specified [closed] Ask Question Asked 7 years, 3 months ago. Invalid Oracle URL specified: OracleDataSource.makeURL.

OracleDataSource.makeURL Error in JCAPS512, Got the error as. Invalid Oracle URL specified: OracleDataSource.makeURL. Then I changed the DriverProperties as setURL#jdbc:oracle:thin:@(​DESCRIPTION  Re: weblogic.common.ResourceException: Invalid Oracle URL specified: OracleDataSource.makeURL 3004 Aug 19, 2001 2:13 AM ( in response to 3004 ) I was having a similar problem using the Oracle Thin driver.

Comments
  • Just handed the cryptic error message over to Google - did you check those search results already? Some of them sound promising.
  • Checked those and non of them explain why or when this error message is given. This is just an illustration of why writing error messages is hard, this generic message just tells me "You did something wrong", yeah, I get that by now, now enable me to fix it.
  • The service name syntax should use forward slash otherwise you'll get a java.sql.SQLRecoverableException (java.sql.SQLRecoverableException: IO Error: Invalid number format for port number) jdbc:oracle:thin:@localhost:1521/servicename
  • I had to use the TNS name instead of sid, like in jdbc:oracle:thin@localhost:1521:tnsname, and then I set the user and password and it worked
  • The hard part for me was seeing that I didn't have a ":" just before the "@". I must have looked at it for 30 minutes. :(
  • @kc2001 That really helps, I actually omitted the : before the @.
  • You are awesome. The much overlooked part. This answer clearly nailed my issue. Thanks!