title: Spring boot oracle connection Invalid Oracle URL specified: OracleDataSource.makeURL
body: <p>In my spring boot application while trying to connect to the oracle database i get the following exception</p>
  
  <pre><code>    java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
      at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1536)
      at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:214)
      at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:184)
      at com.pravaa.apex.MainController.getEmployees(MainController.java:22)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  </code></pre>
  
  <p>My properties file is as below:</p>
  
  <pre><code>    #Oracle connection
      oracle.username=a_test_erd
      oracle.password=somepassword
      oracle.url=jdbc:oracle:thin:@abc.def.com:1521:XE
  </code></pre>
  
  <p>My configuration class is as below:</p>
  
  <pre><code>import java.sql.SQLException;
  
  import javax.sql.DataSource;
  import javax.validation.constraints.NotNull;
  
  import org.springframework.boot.context.properties.ConfigurationProperties;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  import oracle.jdbc.pool.OracleDataSource;
  
  @Configuration
  @ConfigurationProperties("oracle")
  public class OracleConfiguration {
      @NotNull
      private String username;
  
      @NotNull
      private String password;
  
      @NotNull
      private String url;
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
      @Bean
      DataSource dataSource() throws SQLException {
          OracleDataSource dataSource = new OracleDataSource();
          dataSource.setUser(username);
          dataSource.setPassword(password);
          dataSource.setURL(url);
          dataSource.setImplicitCachingEnabled(true);
          dataSource.setFastConnectionFailoverEnabled(true);
          return dataSource;
      }
  }
  </code></pre>
  
  <p>I tried the solutions provided here <a href="https://stackoverflow.com/questions/1332869/invalid-oracle-url-specified-oracledatasource-makeurl">Invalid Oracle URL specified: OracleDataSource.makeURL</a> and few other posts. Still have the same issue. Can someone help.</p>