Send Socket create TCP/IP connection

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Tue, 31 Jan 2006 2:49 pm

Masters I have a big problem My system needs to communicate with an electronic display of password and Office. Those who have the receptions of hospitals.

I need to create a TCP/IP connection with host/port: 192.1.3.180/4000 sending data and number Office today is done in java using socket and we need to put it in a procedure in the forms.

Anyone ever done this?
valeu: shock:
ohoseki
Location: sp

Poston Tue, 31 Jan 2006 4:04 pm

I'vê never done that, but I think you'll get with the UTL_TCP.
http://www.lc.leidenuniv.nl/awcourse/or ... /u_tcp.htm http://www.lc.leidenuniv.nl/awcourse/or ... u_tcp2.htm
Code: Select all
SQL> desc utl_tcp
Element                        Type     
------------------------------ ---------
CONNECTION                     TYPE     
CRLF                           VARIABLE 
BUFFER_TOO_SMALL               EXCEPTION
END_OF_INPUT                   EXCEPTION
NETWORK_ERROR                  EXCEPTION
BAD_ARGUMENT                   EXCEPTION
PARTIAL_MULTIBYTE_CHAR         EXCEPTION
TRANSFER_TIMEOUT               EXCEPTION
BUFFER_TOO_SMALL_ERRCODE       CONSTANT 
END_OF_INPUT_ERRCODE           CONSTANT 
NETWORK_ERROR_ERRCODE          CONSTANT 
BAD_ARGUMENT_ERRCODE           CONSTANT 
PARTIAL_MULTIBYTE_CHAR_ERRCODE CONSTANT 
TRANSFER_TIMEOUT_ERRCODE       CONSTANT 
OPEN_CONNECTION                FUNCTION 
AVAILABLE                      FUNCTION 
READ_RAW                       FUNCTION 
WRITE_RAW                      FUNCTION 
READ_TEXT                      FUNCTION 
WRITE_TEXT                     FUNCTION 
READ_LINE                      FUNCTION 
WRITE_LINE                     FUNCTION 
GET_RAW                        FUNCTION 
GET_TEXT                       FUNCTION 
GET_LINE                       FUNCTION 
GET_TEXT_NCHAR                 FUNCTION 
GET_LINE_NCHAR                 FUNCTION 
FLUSH                          PROCEDURE
CLOSE_CONNECTION               PROCEDURE
CLOSE_ALL_CONNECTIONS          PROCEDURE

SQL>
here's an example: (connects on a web-server and get the first document to open)
Code: Select all
DECLARE
  c  utl_tcp.connection;  -- TCP/IP connection to the Web server
  ret_val pls_integer;
BEGIN
  c := utl_tcp.open_connection(remote_host => 'www.acme.com',
                               remote_port =>  80,
                               charset     => 'US7ASCII');  -- open connection
  ret_val := utl_tcp.write_line(c, 'GET / HTTP/1.0');    -- send HTTP request
  ret_val := utl_tcp.write_line(c);
  BEGIN
    LOOP
      dbms_output.put_line(utl_tcp.get_line(c, TRUE));  -- read result
    END LOOP;
  EXCEPTION
    WHEN utl_tcp.end_of_input THEN
      NULL; -- end of input
  END;
  utl_tcp.close_connection(c);
END;
there is also the possibility to make a JAVA STORED PROCEDURE that gets the job done. (here on the forum has a few examples).

:-o
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Wed, 01 Feb 2006 10:19 am

Legends. It worked. I used the following code:D
Code: Select all
   
    declare
       c  utl_tcp.connection;  -- TCP/IP connection to the Web server 
        x pls_integer;
     BEGIN
       c := utl_tcp.open_connection('192.1.3.180', 4000);  -- open connection
 
       x := utl_tcp.write_line(c, '!#'||chr(9)||chr(9)||chr(1)||chr(4)||chr(4)||'.');    -- send HTTP request
--A linha acima envia os numeros do consultório e a senha
       x := utl_tcp.write_line(c);

       utl_tcp.close_connection(c);
       
     exception
        when others then
        message(sqlerrm);
       
     END;
ohoseki
Location: sp

Poston Mon, 28 May 2007 11:35 am

Appreciate if you help me, I'm tired of looking for and can't find a way to solve my problem: I have a file that I want to send daily to a port 80 http address of the database server for a site.

Can you help me please.

It's new to me and have urgency.

Thank you
apac
Location: Odivelas



Return to PL/SQL

Who is online

Users browsing this forum: No registered users and 4 guests