var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Newbie: Best practice wanted for a little C-Prog to do a simple query
I was just dropped in to code for Oracel 11r2 in C.
I'm used and expierienced for Adabas (eSQL/C), PostGres, SapDB and other.
The Oracle OCI API are looking something confusing to me, especially the concept to log on into an RDBMS Instance on an remote server.
I managed to use the remote connection via sqlplus remote like:
Also I was able to execute the SQL Code Examples from the Oracle Oci Example.
$ sqlplus email@example.com:1521/STORAGE
To provide the Example Data.
Compiling and exuting of the C-Code is also working, but I get stuck to provide the "connection" string and get remote connect working.
excerpt of stage1.c:
static text *username = (text *) "ocihol";
static text *apppassword = (text *) "welcome";
static char *connstr = (char *) "@192.168.11.44:1521/LAGER";
OCIEnv *envhp = (OCIEnv *)NULL;
static OCIAuthInfo *authp = NULL;
// later in main I()
checkenv(envhp, OCIHandleAlloc(envhp, (void **) &authp, OCI_HTYPE_AUTHINFO, (size_t) 0, (void **) NULL));
/* setup username and password */
checkerr(errhp, OCIAttrSet(authp, OCI_HTYPE_AUTHINFO, (void *) username, strlen((char *)username), OCI_ATTR_USERNAME, errhp));
checkerr(errhp, OCIAttrSet(authp, OCI_HTYPE_AUTHINFO, apppassword, strlen((char *) apppassword), OCI_ATTR_PASSWORD, errhp));
I do not see, where the remote connection is defined to use from C-Code.
My newbie Questions:
What is the easiest way to connect to an remote Oracle Instance in C (linux)?
Do you have an pointer for me, with a very smal minimal C-Code Snipplet for remote connect in OCI API?
It seems not clear to me, howto setup and define remote connections...