Home » Developer & Programmer » Precompilers, OCI & OCCI » OCI and Threaded applications (Solaris 10, Oracle 10g)
OCI and Threaded applications [message #589132] Tue, 02 July 2013 09:57 Go to next message
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 #589151 is a reply to message #589132] Tue, 02 July 2013 16:05 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
It sounds to me as though you are trying to write an application which has already been written. You can use the Scheduler to launch a job to read the file into tables automatically whenever a file arrives,

http://docs.oracle.com/cd/E16655_01/server.121/e17636/schedover.htm#CHDHBAFC

Re: OCI and Threaded applications [message #589184 is a reply to message #589151] Wed, 03 July 2013 03:56 Go to previous messageGo to next message
clancypc
Messages: 36
Registered: December 2006
Member
That looks potentially useful, although it takes all the fun out of learning how to write a threaded program Smile . Is the scheduler in 10g? That link is pointing me to an Oracle 12c admin guide.
Re: OCI and Threaded applications [message #589187 is a reply to message #589184] Wed, 03 July 2013 04:05 Go to previous messageGo to next message
John Watson
Messages: 8922
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 Go to previous messageGo to next message
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.
Re: OCI and Threaded applications [message #635715 is a reply to message #589213] Tue, 07 April 2015 05:45 Go to previous messageGo to next message
waleed030
Messages: 1
Registered: April 2015
Junior Member
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.????

____________________
GuL

[Updated on: Tue, 07 April 2015 05:45]

Report message to a moderator

Re: OCI and Threaded applications [message #635718 is a reply to message #635715] Tue, 07 April 2015 06:07 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

What is the purpose of answering in a 2 years old topic especially when you actually add nothing?

Previous Topic: Setting up Pro*C Pre compiler in Windows
Next Topic: Cannot get one command line parameter from a response file
Goto Forum:
  


Current Time: Thu Mar 28 12:59:51 CDT 2024