0
votes

using Java7, with ojdbc7.jar in classpath

works on Windows, with 12c db and Java7 app on same server

fails on AIX, with db and app on different servers

(unfortunately do not have login access to the AIX db server)

12c tnsping SID succeeds on AIX app server, displaying same HOST and PORT as JdbcUrl=HOST:PORT:SID used by Java7 app

12c sqlplus is able to connect successfully to db, but jdbc connection attempt returns the following error:

ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist IBM AIX RISC System/6000 Error: 2: No such file or directory Additional information: 2311 Additional information: 214767799

(sqlplus is able to connect, so please do not suggest Oracle startup)

thanks in advance for any suggestions on troubleshooting either the Java7 client app or the remote db server JDBC connectivity

1
Is the 12c TNS alias defined (in your tnsnames.ora) with the SID or service name; and does that actually match the alias? It sounds like maybe the config has been copied from somewhere else, the alias has been left as it was, but the connection data has been modified so they no longer match. There's no requirement for them to match, of course, but it can be confusing when they don't. Please add the TNS config to the question. - Alex Poole
thanks for your quick response, Alex --- JdbcUrl=jdbc:oracle:thin:@cstgdb501:1525:STG57 --- tnsnames.ora:STG57 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = cstgdb501)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = STG57) ) ) - 7579
The TNS connection is using service name rather than SID, so maybe they are just different in that database; perhaps an old service name has been kept for compatibility. Is JDBC any happier with a URL like @cstgb501:1525/STG57 - i.e. with a / instead of the final :? - Alex Poole
yes, thanks very much, Alex, JDBC seems much happier with a slash character after the PORT identifier - seems like this issue is resolved - 7579

1 Answers

0
votes

Your TNS alias is defined with a SERVICE_NAME rather than SID, and as connecting with that alias works the service name is valid, but the database has a SID which is different to that - which is perfectly valid. Perhaps an old service name has been kept for compatibility, for example.

Your JDBC URL is using the SID construct as it ends in :STG57. If you make it end with /STG57 instead then you will be using the service name construct instead:

jdbc:oracle:thin:@cstgb501:1525/STG57

You will then be using the same connection data as SQL*Plus is via TNS.

You can read more about the JDBC URL syntax in the documentation.