Hi there,

I'm currently working on turning a huge, multi-platform application from using oci into using occi. For two days now, I have being digging through ridicules Oracle occi-demos to see how things should be set up. Besides the point that those samples are written (at least partially) so badly, that it is hard to believe that Oracel dares to provide this actually as a sample, it did gave a starting point, which the documentation entirely failed to do. The documentation is machine-generated and thus, useless. No word about return codes, exceptions or what else might be of interest. Awful! Here is an example:


This method establishes a connection to the database specified.
(author: Ohhh! Really!??)

Connection * createConnection(const string &username,
const string &password,
const string &connectString);
The name of the user to connect as. ( author: Honestly? can that be true?)
The password of the user. ( author: What a surprise!!)
The database to connect to. ( author: I’d never expect that!!)

… and that’s it !!! What if it fails? Of course, it never does, it’s Oracle. It’ll always find the DB and user/pwd will always be correct. Not a word! And that’s the type of documentation you’ll get for classes/methods. I would be beaten out of the door by my boss in person if I would deliver something like this as a docu. Ok, enough about this.

Here are some problems I came across in the last two days:

Env: W2K, MSVC6.0, Oracle

1.) The first sample I've comiled, 'occidml.cpp' compiled fine after a few minor changes and even linked correctly. Running the sample however was a different story, crashed right away. Nice sample. After many hours digging in the internet and in Oracles help desk (metalink) I've found that linking ain't not that easy as it seemed to be. Because what ever Oracle did when they compiled the 'oraocci9.lib', it wasn't what the majority of us would do. To make it work anyhow they claimed you should set '/nodefaultlib:"libc"' plus link it strictly against msvcrt.lib+msvcprt.lib. Now, for the demo it worked, but there will be hardly any serious application in the world that is that simple. What if I had to link against libraries that do not like that type of tricks? That's exactly what happened, linking against some of our own libs as well as MQSeries(IBM) libs caused the linker to spit out more than 70 errors. Btw: works fine with the 'oci.lib' only, as a proof for the 'screwed up oraocci9.lib' .

2.) Trying to use the 'ConnectionPool' object. The sample, again ridiculous like hell, showed a single threaded application, creating a connection pool, out of this creating a single connection, selecting something on the DB with this connection and say good by. Oh, this is why we need a connection pool!! So I converted the app into a multithreaded thing, starting 50 threads and each of them having a (endless) loop accessing the connection pool, asking for a connection, with the connection creating a simple select statement, executing the statement, looping over the result set and starting all over. Having enough experience in working with threads, believe me, the app is still dead simple and there is nothing involved that would require the use of thread synchronization – unless of course the docu again tries to hide the most important information's and it DOES need synchronisation. But than again, why would the environment (created prior to the connection) offer a style named 'Environment::THREADED_MUTEXED'. Anyhow, the outcome from my sample is that it crashes after a while on the point where it tries to create a statement out of the connection gathered from the pool, no exception, nothing, just plain vanilla access violation (0x00000005). Cool, I start to love it!

3.) Playing again with the first sample 'occidml.cpp' it suddenly hit me that nowhere in the sample a 'commit' was issued, yet the inserted row showed up in the select (from another session of course) and stayed there. Ok, so I was searching the nice docu again, found the method 'setAutoCommit' from the Statement object. Ok, the docu, to my surprise of course, tells that this method turns the auto-commit feature on and off. Man, what a surprise again. I inserted this line and set the feature to 'false' to find out that it doesn't do a thing. Sample finishes and the record is there again. By all the experience so far you could surely say: 'no, I'm not surprised by that anymore', but I was. Maybe it's me, should change my attitude to expect the opposite – or better nothing at all – just wonder and see what it does.

Closing words:
If anyone has solutions or even success-stories to tell, please do, convince me that there is more to occi than what I experienced!