Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
Showing results for 
Search instead for 
Did you mean: 

UTL_TCP: Connection refused

Go to solution
Ryan Kogelheide
Frequent Advisor

UTL_TCP: Connection refused

SQL> set serveroutput on size 100000
SQL> Declare
2 con UTL_TCP.connection;
4 Begin
5 con := UTL_TCP.open_connection ('',3001);
6 dbms_output.put_line('Connection Opened');
7 UTL_TCP.close_connection(con);
8 dbms_output.put_line('Fini.');
9 exception
10 when others then
11 UTL_TCP.close_all_connections;
12 raise;
13 End;
14 /
ERROR at line 1:
ORA-20002: Connection refused
ORA-06512: at line 12

I get the same error with a C++ program. What is required to open a port on HP-UX? For example, does the port have to be declared somewhere like /etc/services (I'm skeptical of this since Forms Server listens on 9001 and it's not declared)?
Honored Contributor

Re: UTL_TCP: Connection refused

try running
netstat -an
to view all network ports and services established and listening.

It works for me (tm)
Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP: Connection refused

Hey Bill,

netstat -an shows my little listener that I wrote in C++, but on

Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP: Connection refused

Hmmm... I realize that that sounds strange. I hid the real IP address I'm using in the original post with

The code to open the connection uses a gethostbyname on the "real" I think this is the problem...
Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP: Connection refused

Well. If I change the IP of the host=gethostbyname() to the primary interface, the C++ test connection now works (though it's interesting that other daemons have *. in the netstat output).

The C++ test conn program is on the same host as the test listener.

The Oracle connection from a remote Win2K PC doesn't work and returns the same "Connection refused" as above.

I assume I'm not meeting proxy problems because I can ftp from the Win2K PC.
Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP: Connection refused

The problem was that there were several interfaces on this machine and I was listening on the wrong one.

The problem with UTL_TCP was resolved by reinstalling the Oracle JVM.