Solved

UTL_TCP.OPEN_CONNECTION RETURNS ORA-20002: INVALID ARGUMENT

Posted on 2002-05-31
8
1,709 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
 
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
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
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 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle regular expression 6 45
sql for Oracle views 8 46
PL/SQL Search for multiple strings 5 39
MULTIPLE DATE QUERY 12 26
Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to recover a database from a user managed backup

929 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

12 Experts available now in Live!

Get 1:1 Help Now