0

I am start to learn Oracle DB. I just install it and use SQL Developer to connect to it. But when I use 127.0.0.1 or localhost in the Hostname field, I get this error:

The Network Adapter could not establish the connection (CONNECTIONID = xxx)

But when I enter the PC's IP address into the Hostname field, I can connect to Oracle successfully.

Could you please explain how I can use 127.0.0.1 or localhost in hostname field to connect to to Oracle?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • This isn't really on-topic. you might have more luck on [dba], though it's possibly a duplicate there. You can change your listener to localhost, [or both](https://stackoverflow.com/a/35746373/266304), though if you use DHCP then it's better to use the hostname rather than its (current) IP. But you also then need to tell the database how to register, via `local_listener`. [This](https://stackoverflow.com/a/35746373/266304) might be a bit useful; or [this](https://stackoverflow.com/a/49267276/266304), or [this](https://dba.stackexchange.com/a/13003/847). There's probably a better duplicate... – Alex Poole Feb 16 '22 at 08:56
  • why do you want to use localhost or 127.0.0.1 instead of what has been proven to work? Your client connection request _must_ specify the same IP address (or a host name that will resolve to the same ip address) as the IP address of the machine running the database. – EdStevens Feb 16 '22 at 14:14

1 Answers1

0

This is a WAG as I've not done this in years, but I'm guessing you need to configure your local database for network connections. Check the docs.

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admqs/configuring-the-network-environment.html#GUID-5FED211C-ACEF-4B75-9071-E08962A47985

Are you sure you can't just "sqlplus" following the install?

Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
  • Hi, I see in the listener.ora file this line: (ADDRESS = (PROTOCOL = TCP)(HOST =x.x.x.x)(PORT = 1521)) It is not hostname but the PC IP address. – mark stevens Feb 16 '22 at 07:34