Solved

UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Posted on 2002-05-31
8
1,704 Views
Last Modified: 2008-02-20
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?
0
Comment
Question by:rkogelhe
8 Comments
 
LVL 4

Expert Comment

by:asimkovsky
Comment Utility
The RAISE keyword should not be there.


Andrew
0
 
LVL 4

Expert Comment

by:jtrifts
Comment Utility
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
0
 
LVL 3

Expert Comment

by:mnicoras
Comment Utility
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
0
 
LVL 3

Author Comment

by:rkogelhe
Comment Utility
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.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Expert Comment

by:Pakshay
Comment Utility
Try running the initplsj.sql as SYS to make necessary Java components accessible via PL/SQL

Pradeep
0
 
LVL 5

Expert Comment

by:sora
Comment Utility
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
0
 
LVL 5

Accepted Solution

by:
sora earned 200 total points
Comment Utility
Maybe you want to run these once again, just to make sure that all the java classes are loaded properly.


$ORACLE_HOME/javavm/install/initjvm.sql => skip if you've done this
$ORACLE_HOME/javavm/install/init_security.sql
$ORACLE_HOME/rdbms/admin/initplsj.sql



sora
0
 
LVL 3

Author Comment

by:rkogelhe
Comment Utility
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
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now