The example below retrieves an Lda_Def structure, executes a statement using the connection, then returns the connection to the cache.
#include <jagpublic.h> #include "oratypes.h" #include "ocidfn.h" #ifdef __STDC__ #include "ociapr.h" #else #include "ocikpr.h" #endif #include "ocidem.h" Cda_Def cda; Lda_Def *lda; #define USERID "system" #define PASSWD "manager" #define DATASOURCE "OCITEST" /* Connect to ORACLE. */ cache = NULL; ret = JagCmGetConnection(&cache, USERID, PASSWD, DATASOURCE, "OCI_7", (void*)&lda, JAG_CM_FORCE); /* Open a cursor, parse stmt, execute, close cursor */ oopen(&cda, lda, (text *) 0, -1, -1, (text *) 0, -1); oparse(&cda, sql_statement, -1, FALSE, 2); ... if (oexec(&cda)) oci_error(&cda); ... if (oclose(&cda)) oci_error(&cda); /* release connection */ ret = JagCmReleaseConnection(&cache, USERID, PASSWD, DATASOURCE, "OCI_7", (Lda_Def *)lda, JAG_CM_UNUSED);