Today, one of the teams was facing the issue
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor. They were trying to connect to Oracle using Spring Boot JPA application and getting the exception at application boot up.
Team was able to successfully connect to Oracle using SQLDeveloper. But, when connecting to Oracle using Spring Boot JPA application it was failing to boot up.
Like most developers, we googled around to find the answers. The popular answer that you will get is as mentioned in this stackoverflow question. The answer suggests that you have to update
tnsnames.ora file and add your service to it.
I knew it is not the right answer as we are able to connect using SQL Developer.
So, I started looking into the Spring Data JPA configuration of the application. The configuration that was giving error is shown below.
In the above configuration, there is only one configuration property that could be possibly wrong —
So, I googled around to find the correct way to specify JDBC url for Oracle.
I learned that there are two ways you can specify JDBC string URL. The two ways are:
As you can see above, we are using the second way to specify the URL. According to second URL syntax,
efsdev is the service name.
Developers mentioned that
efsdev is the SID. So, we need to use the first URL.
After changing the configuration to the one mentioned below, application was successfully able to connect with Oracle.
That’s it for this post. I hope this saves someone’s day.