• C

Reading a file through Pl./SQL and writing a file through C

In my project design, one pro*c/c++ program opens a file and writes log messages into it. And these message are popup in forms5 as and when it generates.
My approach towards this problem in two ways
1) I created a program to write log messages in a file and another PL/SQL program for reading that file. Problem is I could not do simultaneously both process!But I need to do both simultaneously!How can solve It?
2) I created a C library program which reads file and returns the string. I connected this library through a external procedure with oracle. Even though I could not solve this problem, due to some memory related errors are poping up when I tried to invoke this library. Error generating point in c library is return statement.  
bobyjoseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jjmcdCommented:
Why not do the mainline in ProC instead of PL/SQL.  This would be pretty straightforward, IMO.
0
cadabraCommented:
Could you explain the architecture of your project -

Where is the logic in your project, that generates the messages which need logging? is it a batch program running in background ?

What causes messages to popup in forms5 ?

Are all you components running on the same machine ?
0
bobyjoseAuthor Commented:
Hi,
     I can not use PL/SQL for writing log messages. The files (reading files) are in binary/hex/Oct formats, which are being generated by hardware device ports. So C or proc is using for reading these files. This process may be happening for one week or two weeks with out any break. During this process, c program (reading file) generates some trace/log messages to a file (log file). Up to this, all operations are happening in backend (DEC Unix). In this project, we are using froms50 as front-end (windows), where we are being tried to demo log-messages to user, who wants to know status of backend file reading process (he/she is siting at client m/c). That is why, I forced to use PL/SQL for reading that log file and tried to display on forms50. And also, I have to do both process simultaneously.
0
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

cadabraCommented:
Option I: can you have your PRO*C program insert info into a special logging table, which you can view from the Forms5 application using regular selects ?

Option II: I have implemented a generic process (listener) which runs on a unix  or NT server. This is a PRO*C program which listens on a DBMS PIPE. Client applications (like FORMS5), request the PRO*C program to view files on the unix machine. Using a simple protocol, the forms application (which acts like a browser) talks to the PRO*C program and requests for table of contents, and then for  specific pages to view from the textfile on the server. This method of having a listener act as an agent on the server machine to enable clients to view log files of server jobs is used in about 50 sites of my company's customers, running FORMS applications against UNIX / NT servers running the Oracle instance. There is no problem with the fact that the file is being written by one process, and concurrently being read by another. This has been implemented on various plaforms NT4 / SUN / DEC / SGI / HP / AViiON / UniSys / Linux / NCR etc.
0
cadabraCommented:
The benefits of option II are that you can use C file I/O functions like seeks, binary block reads etc. You can emulate functionality of "tail -f" behaviour on the Forms5 application.
By having the listener process maintain a map (like a table of contents or index) of the file being viewed (while  it is being written).
This will let your Forms5 client, at each refresh, know how many pages exist in the file at the server, and lets you jump to any page (first / last / specific) etc.

If you are interested in this implementation, I can post more information.
0
bobyjoseAuthor Commented:
Yes, I am interest to know a more about this method. Could u pls send more details with example pgms ? my mails id is bobyjose@india.dharma.com;
0
bobyjoseAuthor Commented:
Yes, I am interest to know a more about this method. Could u pls send more details with example pgms ? my mails id is bobyjose@india.dharma.com;
0
cadabraCommented:
Later today, I can send you sources (PRO*C) for unix, of the listener (this version does not support the file background file mapping, however you can add this yourself quite easily).
Also I will send a SQL script (with PLSQL code) that emulates the client (Forms) logic.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.