Home » Developer & Programmer » Forms » Read File from Unix (Database server) (Forms 10G, Unix.)
Read File from Unix (Database server) [message #451548] Thu, 15 April 2010 06:20 Go to next message
bahubcd
Messages: 40
Registered: July 2007
Location: Bangalore
Member
Dear all,
I tried to search this forum, but some how I feel my question is so simple and straight forward that I was not able to get the direction from the answers given to very complicated questions.

I need to develop a form which has to read and display the contents of a text file that is stored in the Unix system where the Oracle data base is installed. So basically its the database server and not the forms application server.

Which approach do I follow and is easy to implement.

1. Create an external table for the file everytime when the form is loaded by dropping and re creating the table and base the data block in the form on that table and execute_query and display the contents.

2. I am confused whether to use webutil or utlfile packages to read from the file and display on the screen as the file resides in the database or Oracle server and not forms application server or client machine.

3. Any other suggestions from the form Gurus.

Appreciate any advise or help in this regards from you all.

Have a nice day,
Bahubcd.
Re: Read File from Unix (Database server) [message #451555 is a reply to message #451548] Thu, 15 April 2010 06:50 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
External table seems to be OK. You do not have to drop and create it every time - what makes you think so? Create it once; it doesn't matter whether file (that is to be read through an external table) changes or not (its contents, that is).
Re: Read File from Unix (Database server) [message #451570 is a reply to message #451555] Thu, 15 April 2010 08:42 Go to previous messageGo to next message
bahubcd
Messages: 40
Registered: July 2007
Location: Bangalore
Member
Thank you very much LF for your reply,

But anyway, If I have to read it from a file directly and display it on the form, then how can I do it? (keeping in mind that the text file is on the data base server).

Just to see if I get an idea of doing it better what I am planning to implement.

Thanks and Regards,
Bahubcd
Re: Read File from Unix (Database server) [message #451624 is a reply to message #451570] Thu, 15 April 2010 15:07 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
If I have to read it from a file directly and display it on the form, then how can I do it?

I don't have Forms installation here to test, so - this is pure theory.

You know how to create an external table, don't you? CREATE TABLE blabla - don't forget to create (an Oracle object named) "directory" which will point to a file system directory that is supposed to contain input file and grant required privileges on that directory to user that will create an external table.

The result is, well, a table. It can (I hope!) be used as a source for a data block in your form. Once you do that, no problem - push <Execute query> and records should be displayed on the screen.
Re: Read File from Unix (Database server) [message #451639 is a reply to message #451624] Thu, 15 April 2010 20:42 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Use a multiline 'control' block, read a line using 'utl_file' or 'text_io', place the line in the row, then go to the next row.

David
Re: Read File from Unix (Database server) [message #451652 is a reply to message #451624] Fri, 16 April 2010 00:21 Go to previous message
bahubcd
Messages: 40
Registered: July 2007
Location: Bangalore
Member
Thank You Littlefloat and DJ Martin for your kind advises. I will surely try to implement them in either ways and update this thread if any other learnings are found.

Thanks and Regards,
Bahubcd.
Previous Topic: ColorPicker Bean
Next Topic: Login page
Goto Forum:
  


Current Time: Fri Sep 20 05:50:49 CDT 2024