Home » SQL & PL/SQL » SQL & PL/SQL » Can i connect to telnet(send commands) from a procedure? (Oracle 10g unix/linux)
icon5.gif  Can i connect to telnet(send commands) from a procedure? [message #346054] Fri, 05 September 2008 14:34 Go to next message
Ruzeil
Messages: 1
Registered: September 2008
Location: Skopje,Macedonia
Junior Member

I'm sorry if i missed the Forum, but please answer me this problem.
I have a function
named login and it goes something like this:

FUNCTION login(username_in IN VARCHAR2,
pass_in IN VARCHAR2,
msisdn_in IN VARCHAR2)
RETURN varchar2--connection_var
IS
ret_val connection_var;
sysdate_var DATE := SYSDATE;
exit_var NUMBER :=0;
BEGIN


server_in := '192.168.1.100';
port_in := '23';

ret_val.tcp:=utl_tcp.open_connection(server_in,
port_in,
NULL,
NULL,
NULL,
NULL,
NULL,
utl_tcp.CRLF,
2);

n := utl_tcp.write_line(ret_val.tcp, 'LOGIN:'||username_in||':'||pass_in||';');
dbms_output.put_line('1');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'1');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'2');
n := utl_tcp.write_line(ret_val.tcp, 'test');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'3');
n := utl_tcp.write_line(ret_val.tcp, 'ruze@tom');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'4');
n := utl_tcp.write_line(ret_val.tcp, '');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'5');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'6');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'7');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'8');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'9');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'122');
n := utl_tcp.write_line(ret_val.tcp, 'exit;');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'10');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'11');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'12');
dbms_output.put_line(utl_tcp.get_line(ret_val.tcp,true)||'13');
utl_tcp.close_connection(ret_val.tcp);
utl_tcp.close_all_connections;
return 'null';

exception when others
then
dbms_output.put_line(sqlerrm);
utl_tcp.close_all_connections;
DBMS_OUTPUT.PUT_LINE('exc'||server_output_var);
RETURN 'exception';
END login;
it suppose to connect to telnet and some commands.
But it hangs up on password, always says wrong password.

Please help
Thanks
Re: Can i connect to telnet(send commands) from a procedure? [message #346060 is a reply to message #346054] Fri, 05 September 2008 15:28 Go to previous message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

This is NOT an Oracle problem.
It is a TCP/IP problem.

I do not have access to any system with port 23 open, so I can't test this.

From the unix command line, what happens when you do:

telnet 192.168.1.100:23

can you actually get logged in and issue OS commands?

use CUT & PASTE to show us what happens.
Previous Topic: Procedure with merge
Next Topic: Question on CURSOR re-use
Goto Forum:
  


Current Time: Sun Dec 04 04:29:13 CST 2016

Total time taken to generate the page: 0.07485 seconds