Posted by Vincent Rogier on July 24th, 2008
A version 2.5.1 is now available !
This release is a patch for the 2.5.0 that came out few days agos with some broken functionnalities.
This updates contains 5 fixes, most of them related to dynamic runtime loading of OCI shared library.
Here is the list :
- Fixed runtime loading of some OCI symbols (broken since v2.5.0)
- Fixed runtime loading of OCI shared library on Unix-like platforms(broken since v2.5.0)
- Fixed connection pooling emulation for Oracle 8i
- Fixed Unicode strings binding to PL/SQL tables of char/varchar
- Fixed Unicode internal buffer expansion for Unix-like platforms (where wchar_t is 4 bytes) that could mess up the data for string arrays binds
OCILIB releases are always internally tested :
- with Oracle 8i, 9i (R1&R2), 10gR2, 11gR1
- on MS Windows Vista, Linux OpenSuse 10
- All Configurations : ansi, mixed, unicode with dynamic linkage to OCI at compile time and dynamic loading at runtime (explicit dynamic loading of OCI library)
OCILIB is also tested by users before a release goes out.
For v2.5.0, tests were done on the wrong packages and few bugs had not been detected.
Sorry for the inconvience !
v2.5.1 corrects now all bugs introduced by v2.5.0 and passed all tests.
Have a nice day !
Posted by Vincent Rogier on July 23rd, 2008
I’ve found that in the OCILIB 2.5.0 releases build with the option OCI_IMPORT_LINKAGE (runtime loading of oracle shared lib, default option for the prebuilt Windows OCILIB Dlls), some symbols where not loaded anymore !
It affects multithreaded applications. The OCI functions related to mutexes were not loaded (the magic of cut’n paste…)
The following code disappeared between 2.4.0 and 2.5.0 in ocilib.c, OCI_Initialize():
LIB_SYMBOL(OCILib.lib_handle, "OCIThreadMutexInit", OCIThreadMutexInit,
OCITHREADMUTEXINIT);
LIB_SYMBOL(OCILib.lib_handle, "OCIThreadMutexDestroy", OCIThreadMutexDestroy,
OCITHREADMUTEXDESTROY);
LIB_SYMBOL(OCILib.lib_handle, "OCIThreadMutexAcquire", OCIThreadMutexAcquire,
OCITHREADMUTEXACQUIRE);
LIB_SYMBOL(OCILib.lib_handle, "OCIThreadMutexRelease", OCIThreadMutexRelease,
OCITHREADMUTEXRELEASE);
So, i’ll make a 2.5.1 release later today !
Posted by Vincent Rogier on July 21st, 2008
A new OCILIB release is available !
Content :
- Added support for PL/SQL tables (PL/SQL arrays) when binding C (native and OCILIB types arrays) to PL/SQL block
- Extended Date, timestamp and interval support : few more functions, added conversion to ISO C time datatypes and now these types can be created independtly from database connections
- Extended OCI_Connection handle attributes : alive status and association of program user data
- Added Support for retreiving server output : calls to dbms_output.put() and dbms_output.put_line() from inside PL/SQL blocks, triggers, procedures, packages, .. can be now retreived by OCILIB
- Added Support for OCI Threadkeys : you can now have a process wide name identifier (key) that can have hold thread specific values (a bit like a getenv() and putenv() but values are stored by thread)
- Extended runtime loading of Oracle shared libs on various Unix-like systems : some exotic sharted lib names (dylib, sh, …) are now handled by the configure script and also managed for runtime time loading of Oracle shared libs
- Added Support for Oracle Instant Client on Unix-like systems : 2 options have been added to the configure script in order to handle Instant Client packages correctly (differents packages for headers and libs + paths are different from regular clients)
- Extended OCILIB documentation : added an installation page for all platforms and all examples have been checked out and extended to full C program source code
- Added more demo source code : now, about 25 example source code ready to compile are provided
- Miscelleanous modifications (see changelog)
Download OCILIB v2.5.0
Full 2.5.0 ChangeLog
Validated platforms :
- Windows
- Linux
- HP/UX
- Solaris
- AIX
- Mac OS X
- OpenVMS
Supported Oracle versions : 8i, 9i, 10g, 11g
Get the latest package and enjoy it ! !
Posted by Vincent Rogier on July 18th, 2008
Today, I was asked on the OCILIB SourceForge forum if OCILIB could handle calls to stored procedures…
Of course, it can ! Here is a basic simple example.
Let’s say you’ve got the following stored procedure :
1
| my_function(code IN NUMBER, str OUT VARCHAR) RETURN NUMBER; |
Here is a full working C program source code to call this procedure:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| int main(int argc, char **argv)
{
int code, res;
char str[31];
OCI_Connection *cn;
OCI_Statement *st;
OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT);
cn = OCI_ConnectionCreate("db", "user", "pwd", OCI_SESSION_DEFAULT);
st = OCI_StatementCreate(cn);
OCI_Prepare(st, "begin :res := my_function(:code, :str); end;");
OCI_BindInt(st, ":res", &res);
OCI_BindInt(st, ":code", &code);
OCI_BindString(st, ":str", str, 30);
code = 5;
res = 0;
str[0] = 0;
OCI_Execute(st);
printf("res = %d, str = %s", res, str);
OCI_Cleanup();
return EXIT_SUCCESS;
} |
That’s all ! Calling stored procedures is really easy with OCILIB
Posted by Vincent Rogier on July 18th, 2008
The OCILIB library (C wrapper for Oracle OCI) has now its own blog !
OCILIB is a free, open source and platform independant library, written in C, that access Oracle Databases.
The OCILIB library :
- Encapsulates OCI (Oracle Call Interface which is powerful but complex)
- Hides OCI complexity
- Proposes instead a simple, readable and reusable API
- Offers up to 350 simple and straightforward APIs.
OCILIB is developed by Vincent Rogier. Get the latest package, install and enjoy it !
A new release v2.5.0 is planned for July 22th, 2008 !
Recent Comments