Pure Oracle::OCI - login to server
Allocate Service Context handle and associate it with the server handle:
OCIHandleAlloc($$envhp, my $svchp=0, OCI_HTYPE_SVCCTX, 0, 0);
$svchp = new_ptr('OCISvcCtxPtr', $svchp); #
OCIAttrSet($$svchp, OCI_HTYPE_SVCCTX, $$svrhp, 0, OCI_ATTR_SERVER, $errhp);
Allocate Session handle, add username/password and login to the server:
OCIHandleAlloc($$envhp, my $authp=0, OCI_HTYPE_SESSION, 0, 0);
$authp = new_ptr('OCISessionPtr', $authp); #
my ($user, $pass) = split /\//, $dbuser;
OCIAttrSet($$authp, OCI_HTYPE_SESSION, dvoid_p_str($user), OCI_ATTR_USERNAME, $errhp);
OCIAttrSet($$authp, OCI_HTYPE_SESSION, dvoid_p_str($pass), OCI_ATTR_PASSWORD, $errhp);
OCISessionBegin($svchp, $errhp, $authp, OCI_CRED_RDBMS, OCI_DEFAULT);
OCIAttrSet($$svchp, OCI_HTYPE_SVCCTX, $$authp, 0, OCI_ATTR_SESSION, $errhp);
Get an OCI attribute from an OCI handle:
OCIAttrGet($$handle, OCI_HTYPE_handle, my $attrib_value, 0, OCI_ATTR_name, $errhp);