I am trying to Homebrew to install Oracle instant_client and sqlplus. Do the instructions discussed here still work:
How to install Oracle Instant Client on a Mac?
I have installed instant client and sqlplus using:
brew tap InstantClientTap/instantclient
brew install instantclient-basic
brew install instantclient-sqlplus
When I try to login to Oracle with sqlplus, I get the error:
ORA-12545: Connect failed because target host or object does not exist
The Oracle XE instance is running in a local Docker container. If I log in to the container, everything works fine. I can also connect to the database using SQLDeveloper. When connecting with sqlplus or oracledb in Nodejs (which uses instant client), I cannot connect.
When I log on to the Docker container, I can log on using sqlplus and the SYSTEM account:
Enter user-name: SYSTEM
Enter password:
Last Successful login time: Wed Dec 21 2022 13:29:35 +00:00
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL>
When I try to log on from the OSX host using sqlplus using SYSTEM, I first get this error:
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 21 13:34:43 2022
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Enter user-name: SYSTEM
Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
I looked up this error and it mentioned having ORACLE_SID defined so I added exported ORACLE_SID=XE. I then got a different error:
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 21 13:40:25 2022
Version 19.8.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Enter user-name: SYSTEM
Enter password:
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Using a JDBC client I can connect using SYSTEM and the url jdbc:oracle:thin:@localhost:1521:XE with.
I can also connect via a nodejs program using nodejs-oracledb to connect the Oracle XE container.
In a nutshell, I can use sqlplus within the Docker terminal, I can connect from the OSX host using jdbc or nodejs oracledb but not with sqlplus.