Home » Developer & Programmer » Precompilers, OCI & OCCI » How to cancel my query in an occi program?
How to cancel my query in an occi program? [message #138241] Tue, 20 September 2005 20:27 Go to next message
firestorm
Messages: 3
Registered: May 2005
Location: china
Junior Member
as the query:
1: ResultSet *rs = stmt->executeQuery();
......
2: while(rs->next (array_fetch_size))
......
For step 1 and step 2, In my application, it will be a long time, maybe 10 min, to finish the occi calls. I had tried to terminate the Environment in anohter thread when time out, and surely I meet error. Then I tried to cancel the thread, also not a good idea.
Does anybody know the way to cancel a query or set a timeout parameter in occi call?
I need you help, thank you Smile
Re: How to cancel my query in an occi program? [message #138431 is a reply to message #138241] Wed, 21 September 2005 23:43 Go to previous messageGo to next message
Dropbear
Messages: 4
Registered: September 2005
Junior Member
with OCI, you have access to non blocking SQL calls, but I'm not sure if the occi libraries expose this functionality.

If you really need this you may need to recode in OCI.
Re: How to cancel my query in an occi program? [message #138489 is a reply to message #138241] Thu, 22 September 2005 04:47 Go to previous messageGo to next message
firestorm
Messages: 3
Registered: May 2005
Location: china
Junior Member
I found the solution. It's easy. use the method getOCIServer to get the oci server handle. Then use OCIbreak in another thread. Then all oci( and occi ) call will be canceled.
Re: How to cancel my query in an occi program? [message #138924 is a reply to message #138241] Sun, 25 September 2005 20:44 Go to previous messageGo to next message
Dropbear
Messages: 4
Registered: September 2005
Junior Member
good find, well done.
Linking Problem :- OCCI/C++/linux(Redhat) please Help [message #150966 is a reply to message #138489] Mon, 12 December 2005 05:57 Go to previous messageGo to next message
manav.sah
Messages: 15
Registered: September 2005
Location: India
Junior Member

hi! i m new in OCI/OCCI...
i m trying to compilea simple occi/c++ program in redhat linux 9 with oracle 9i.
i m compiling the program as

g++ ./occi1.cc -I/opt/ora9/product/9.2/rdbms/demo/ -I/opt/ora9/product/9.2/rdbms/public/ -c


and linking as :-

g++ ./occi1.o /opt/ora9/product/9.2/lib/libocci9.a /opt/ora9/product/9.2/lib/libclntsh.so

[./occi1.o(.gnu.linkonce.t._ZN7occidmlC1ESsSsSs+0x20): In function `occidml::occidml[in-charge](std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned), void* (*)(void*, void*, unsigned), void (*)(void*, void*))'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `cerr'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__pure_virtual'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `exception type_info function'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__cp_push_exception'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `endl(ostream &)'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__uncatch_exception'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__out_of_range(char const *)'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__rtti_user'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__ctype_toupper'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__rtti_si'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__check_eh_spec'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__throw'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `ostream::operator<<(char const *)'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `terminate(void)'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__start_cp_handler'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__cp_pop_exception'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `exception type_info node'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__builtin_vec_new'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__eh_rtime_match'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__length_error(char const *)'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__builtin_vec_delete'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `exception virtual table'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__rtti_class'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__builtin_delete'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__builtin_new'
/opt/ora9/product/9.2/lib/libocci.so: undefined reference to `__eh_alloc'
collect2: ld returned 1 exit status



pls help me to get over these error...
and guide me how to link the occi program...
is there any other file needed..
thanks
Best Regards
Manav Sah

icon9.gif  Re: How to cancel my query in an occi program? [message #214502 is a reply to message #138489] Tue, 16 January 2007 15:56 Go to previous message
ifer
Messages: 1
Registered: January 2007
Junior Member
I attempt you method in a class with OCCI:

1. get handle in connection procedure with:
ptrOCIServer = cnn->getOCIServer();

2. in the query procedure:
pthread_create( &m_threadTimeout, NULL, cancelQuery, this );
myStatement->executeUpdate();

3. into a thread:
void * cancelQuery( void * args ) {
MyObject * ptrMyObject = (MyObject*)args;
OCIError * ptrOCIError;
int intResult = OCIBreak((OCIServer *)ptrMyObject->ptrOCIServer, ptrOCIError);
....

but show the "Segementation fault" exception message. Where the error?
Previous Topic: Pro*C in UNIX Help NEEDED
Next Topic: loading data from flat file into remote oracle table
Goto Forum:
  


Current Time: Fri Dec 09 19:42:05 CST 2016

Total time taken to generate the page: 0.20409 seconds