Suivre ce blog
Administration Créer mon blog

Search

Free tool

Look and Feel Project

7 février 2006 2 07 /02 /février /2006 15:31
With the old C/S versions, the TEXT_IO package allowed to manipulate text files on the client machine.

Since the Web versions, this package allows to manipulate text files on the Application Server machine.

To allow developers to  manipulate text files on the client machine, the Webutil CLIENT_TEXT_IO equivalent was created.

These two packages are equivalent in term of functionality, but not in term of speed.
The difference comes from the network roundtrips used to transfer the data from the server to the client machine.

On the following screenshot, you can see a Forms dialog that use both TEXT_IO and CLIENT_TEXT_IO functions.

On the left part, the text file is created on the client machine with the CLIENT_TEXT_IO functions.
On the right part, the text file is created on the server machine with the TEXT_IO functions.


TEXT_IO vs CLIENT_TEXT_IO

For this basic test case, we created a text file with 50 lines read from a database table.

It need 15 seconds to create this file on the client machine, but only one to create the file on the server machine and download it on the client machine.

So, don’t use the CLIENT_TEXT_IO functions, but generate the file on the server machine then download it on the client machine with the WEBUTIL_FILE_TRANSFER.AS_to_client() function.


This is the test table creation script:

CREATE TABLE TEST_TEXTIO
(
   CODE  NUMBER(5) PRIMARY KEY
  ,COL1  VARCHAR2(50)
  ,COL2  VARCHAR2(50)
  ,COL3  VARCHAR2(50)   
)
 
BEGIN
  FOR i IN 1 .. 50 LOOP
    INSERT INTO TEST_TEXTIO
    VALUES
    (
       i
      ,RPAD(TO_CHAR(i),40, TO_CHAR(i))
      ,RPAD(TO_CHAR(i),40, TO_CHAR(i))
      ,RPAD(TO_CHAR(i),40, TO_CHAR(i))
    );
  END LOOP ;
END;


You can download the TEXT_IO.fmb Forms 9.0.2 test dialog here

Francois

Partager cet article

Francois Degrelle - dans Oracle Forms
commenter cet article

commentaires

From Phil 21/08/2008

Hi Francois,Thanks for your blog and it did help me a lot.What you wrote is what I want to know.I do appreciate what you have done. I do not know Frech but can read your english topics.Regards,Phil

Vanessa Fernandez 07/05/2010



Hello,


 First of all I would like to thank you for sharing all this knowledge. I´m writing because I would like to ask for your advice on something. I need to save a .csv file on the client machine
and I´m using webutil for that. I read your article about using WEBUTIL_FILE_TRANSFER.AS_to_client, and I´m trying to use it myself, but I´ve had no success.


I have the database server on one machine and the application server on another one. The csv file is created on the database server through a package using the utl_file utilities. I created a G:
drive in the application server to access the database server, in order to copy the file to the client. The copying code is this:


WEBUTIL_FILE_TRANSFER.AS_to_client( l_client_filename, 'G:csv_name)


The thing is that the file isn't copied, and when I try to capture the error I got: normal, succesfull completion.  I've already changed the webutil.cfg, and given permissions to read G:. So
I have no idea of what else to try. Could you please help on this? Thanks in advance,


Vanessa



Maciej Myrcha 16/11/2010



Hi Francois,


I've read your article and have some questions: we try to save some DB records to a flat file and the performance is crucial here. 150,000 records make a about 15 MB file and while with
client_text_io it takes 80 seconds, with text_io it is about 28 seconds. However when I've changed a loop a little bit not to save a file line by line, but instead creating a varchar2 variable to
store lines and then save it to a file, performance od client_text_io is comparable with text_io on AS side. Plus you have to move the file from AS to client, which takes additional 15 secons.
What's more surprising, the same trick (with variable) doesn't seem to work with text_io - the time doesn't change. So now I'm confused - do you have any new ideaas about I/O operations on
client?


sincerelly


Maciej



Jens Rettig 09/12/2011


Hi,


nice, short and helpful article, thanks for that.


In addition to performance issues, I've come across a situation, where creating 3000+ records simply does not work (crashes), while doing it via text_io works no problem. So maybe you always
should create on the AppServer, then move the file to the Client ?

ravi teja 13/12/2013

hi Francois, thanks for the post it gave me an alternate idea to my requiremnt. I wrote a java code in the oracle procedure to read a file and display the output. im able to succeed it by reading the file in server. Now i want the same code to be executed so as to read a file in the same path from the client machine? if so could you please guide me.
Thanks in advance.
Ravi teja