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.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Ryan Kogelheide
Frequent Advisor

UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

SQL> set serveroutput on size 100000
SQL> Declare
2 con UTL_TCP.connection;
3 ret PLS_INTEGER;
4 Begin
5 con := UTL_TCP.open_connection ('c7pc1248',7788);
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 /
Declare
*
ERROR at line 1:
ORA-20002: Invalid argument
Invalid argument
ORA-06512: at line 12
.
.
Note that UTL_SMTP works fine from the same server.

Any ideas?
5 REPLIES
Steve Steel
Honored Contributor

Re: UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Hi

http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a89852/utl_tcp.htm

http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a89852/utl_tcp4.htm


You should check the parameter format for the call.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Cheryl Griffin
Honored Contributor

Re: UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Ryan,
I am no SQL person, but your script is similar to one posted here which shows how to set it up for testing.

http://www.exzilla.net/exDocs/internetPackages/Internet-Packages-utl_tcp.shtml

Cheers!
Cheryl
"Downtime is a Crime."
Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

I've checked the parameters. I think that there is perhaps a bug or a problem with the port or a problem with the version of the UTL_TCP definition.
Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Thanks for the link. My Thai is not quite up to that level though :).

I've reposted the question because I've noticed that the procedure returns a "Connection refused" when it is run from an NT server.

I suspect that the error is not correctly handled on the HP-UX version of 8.1.7.

Ryan
Ryan Kogelheide
Frequent Advisor

Re: UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

The eventual solution was to reinstall the jvm and java stored procedures (initplsj by itself was not sufficient):

$ORACLE_HOME/javavm/install/initjvm.sql $ORACLE_HOME/javavm/install/init_security.sql
$ORACLE_HOME/rdbms/admin/initplsj.sql