OCI and Threaded applications [message #589132] |
Tue, 02 July 2013 09:57 |
clancypc
Messages: 36 Registered: December 2006
|
Member |
|
|
Does anyone out there have any experience of writing a threaded OCI application?
I am writing an application to load data into a database. The general idea is:
Have a parent process that sets up the environment handle, error handle, server handle etc.. Then it will go to a directory and monitor it for any arriving files to be loaded. When it detects a file it creates a child thread to process the file.
The child thread will then create the statement handle and bind handles, process all the data in the file and load it into the database.
My initial thoughts were to create the threads using POSIX threads, but I have noticed in the OCI Programmers Guide that there are OCI thread functions. Does anyone know if I should be using these instead of the POSIX functions or in addition to the POSIX functions?
Thanks
|
|
|
|
|
Re: OCI and Threaded applications [message #589187 is a reply to message #589184] |
Wed, 03 July 2013 04:05 |
John Watson
Messages: 8962 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Oh, sorry - I missed the fact that you are on 10g, so I assumed the current release. Release 10.2.x has the Scheduler, with event based jobs. But (if I remember correctly) it does not have a pre-configured file watcher, so you have to write your own. Several people have done this, Google around and you may (start hoping!) find an example.
|
|
|
Re: OCI and Threaded applications [message #589213 is a reply to message #589187] |
Wed, 03 July 2013 06:11 |
clancypc
Messages: 36 Registered: December 2006
|
Member |
|
|
I have the basic program complete. It can monitor the incoming file directory and load a single file at a time using OCIBindArrayOfStruct function. The next stage is to make it multi threaded so I can load multiple files at a time. My original plan was to use POSIX threads, that was until I saw the section on threads in the OCI Programmers Guide which has made me pause. I am not sure how these funtions interact with the POSIX functions, if they interact at all or if they are mutually exclusive?
I will continue studying the OCI guide, maybe it will become clear to me.
|
|
|
|
|