Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Posted on 2002-05-31
8
Medium Priority
?
1,749 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
ID: 7046745
The RAISE keyword should not be there.


Andrew
0
 
LVL 4

Expert Comment

by:jtrifts
ID: 7047073
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
ID: 7047208
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Author Comment

by:rkogelhe
ID: 7047325
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
 
LVL 1

Expert Comment

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

Pradeep
0
 
LVL 5

Expert Comment

by:sora
ID: 7050370
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 800 total points
ID: 7050371
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
ID: 7053378
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

926 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