-1

I m trying to connect oracle DB in DBeaver so it was working fine and I can able to fetch data and able to connect it but after restarting my system I am getting the below error in the DB connection.

enter image description here

If I try to connect the Same DB from my local nodejs code it's giving the below error.

Oracle Connection error : { [Error: ORA-12170: TNS:Connect timeout occurred] errorNum: 12170, offset: 0 }

Can anyone help me to solve this issue?

EDIT: I tried to set my IP in connection string while connecting DB through Node.js

(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=SID)(CID=(PROGRAM=app.js)(HOST=HOST-URL)))(ADDRESS=(PROTOCOL=tcp)(HOST=MY-CURRENT-IP)(PORT=1524)))

still same error:

connection timeout :(

not sure what configuration missing here.

Thanks in advance!

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
  • where is the oracle db located; in same host ? and what version is it ? – Nizam - Madurai May 19 '21 at 07:42
  • "after restarting my system" - maybe the machine the DB is on has a dynamic IP address, and that changed on restart; is 173.36.101.240 still the correct IP address? – Alex Poole May 19 '21 at 08:28
  • 1
    No my current IP is different from this how can I change it to current IP ? – CodeChanger May 19 '21 at 08:40
  • Run `LSNRCTL STATUS` in command line and check if it is running. Also check if Oracle services are running as well. I've faced the same issues with "default" installation on Windows and it was due to services didn't start – astentx May 19 '21 at 09:29
  • this command is unknown windows not taking this command on CMD. How can I check :( – CodeChanger May 19 '21 at 10:42

2 Answers2

0

The error means that given server (host : port) is inaccessible from the source host where you try to connect to it. It can be due to:

  • blocked firewall port
  • Oracle server settings (settings like "which network interfaces should I listen to").
  • mistake in the host IP or port number.
alexb
  • 453
  • 4
  • 11
0

"No my current IP is different from this how can I change it to current IP"

The fundamental problem is that you are running your db on a machine that is getting its IP address dynamically. It changes on every restart, making your database a moving target. If this is your personal PC, then the best solution is to use VirtualBox to create a VM. Configure that VM with a HOSTONLY adapter, then when the OS is installed, give it a fixed IP address, then install oracle.

If this is not your personal machine (you cannot create a VM) then explain more about the machine where your database is installed.

EdStevens
  • 3,708
  • 2
  • 10
  • 18
  • It's my office machine so I cant create VM on it and regarding server, my oracle DB installed on the Server and I don't have much idea about it. is it due to server machine configuration bcus on Mac machine I can able to connect t without any error so? – CodeChanger May 20 '21 at 04:42
  • The first thing we need to do is see what the listener is doing. At a command prompt on the machine that runs the database, execute 'lsnrctl status'. Then copy the command and response from the command window and paste it into your original question. – EdStevens May 20 '21 at 11:56
  • actually, I don't have Production server access I have only production DB credentials only so I think it's not server issue only my system creating probelm. – CodeChanger May 21 '21 at 05:04
  • I would agree that it's not a 'server issue', but we have to know what the server is doing and how it is configured before we can know how to configure the client. So why aren't you working this with your DBA - the guy who _does_ have server access? – EdStevens May 21 '21 at 12:44