Search code examples
oracle-databasejdbcsqlplus

Getting ORA-12514, but we can connect via SQLPlus


We are suddenly getting the error ORA-12514, TNS:listener does not currently know of service requested in connect descriptor in our application.

Googling this seems to suggest a couple of easy solutions (e.g. found here), but they don't work for us.

The perplexing thing is:

  • We can connect via SSH to the server running our application, and..
  • we can connect with SQLPlus on that server, ..
  • using the exact same JDBC connection parameters as the app (we can get them from a log during application startup, so we are sure they are the same).

Why could it be that we can connect to the DB with SQLPlus, but our app cannot?

Here are the two methods to connect (JDBC and SQLPlus), both consistently anonymised:

JDBC

{
jdbcDriver=oracle.jdbc.OracleDriver,
jdbcUser=THE_USER,
jdbcPassword=THE_PASSWORD,
configurationVersion=1.0.14,
jdbcURL=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=THE_HOST)(Port=THE_PORT))(CONNECT_DATA=(SERVICE_NAME=THE_SERVICE_NAME)))
}

SQLPlus

sqlplus THE_USER/'THE_PASSWORD@'"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=THE_HOST)(Port=THE_PORT))(CONNECT_DATA=(SERVICE_NAME=THE_SERVICE_NAME)))"

Solution

  • According to our DB specialist there were "wrong entries in Oracle Internet Directory (OID)".

    They cleaned it up and now it ist working again. Sorry that this is not very helpful as an answer, but I don't know more details...