Link to home
Start Free TrialLog in
Avatar of rkogelhe
rkogelhe

asked on

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?
Avatar of asimkovsky
asimkovsky

The RAISE keyword should not be there.


Andrew
Avatar of jtrifts
To elaborate on Andrew's comment...the raise statement "RAISE;" is inappropriate for an anonymous PL/SQL block.  It's intended use is to propagate an error back to the calling procedure (which does not exist in an anonymous block).
Regards,
JT
Hi,

first of all I want to say that's really strange guys to say that RAISE is the problem here!!! hey, come-on, you must be kidding!

I'm just looking to the error and it's 20002 which means that is a user-defined exception inside utl_tcp package. So I think that probably the utl_tcp is not proper installed. Did you installed directly from the kit or take it from another server type!!! It's about CRLF I think!

Anybody has another suggestion,
Marius Nicoras
Avatar of rkogelhe

ASKER

It was installed during the install of Oracle 8.1.7 on HP/UX 11.

I think I agree that it is probably an installation problem as it worked from a Win2000 install of 8.1.7. I wonder if there is an easy way to reinstall it.
Try running the initplsj.sql as SYS to make necessary Java components accessible via PL/SQL

Pradeep
I ran your code exactly as you posted it, just changed the server name to my SMTP server and it worked just fine!!


zgeda1_GEDAC2> Declare
  2   con UTL_TCP.connection;
  3   ret PLS_INTEGER;
  4   Begin
  5   con := UTL_TCP.open_connection ('www.xxx.com',25);
  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  /
Connection Opened
Fini.

PL/SQL procedure successfully completed.



sora
ASKER CERTIFIED SOLUTION
Avatar of sora
sora
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The reinstallation of the jvm did it I think. I tried just the initplsj.sql before and that didn't help.

Thanks very much all of you for your help. :)

Ryan