oracle object 初使化,oracle oci 初始化步骤

int errnum = 0;

errnum = OCIEnvInit( (OCIEnv **) &m_pOCIEnv, OCI_DEFAULT|OCI_THREADED, (size_t) 0,

(dvoid **) 0 );

if(errnum) {

Debug(__LINE__,__FILE__,"Initializing to Execute OCIEnvInit");

return -1;

}

errnum = OCIEnvCreate( &m_pOCIEnv, OCI_OBJECT, (dvoid *)0, (dvoid *(*)(dvoid *, size_t))0,

(dvoid *(*)(dvoid *, dvoid *, size_t))0, (void (*)(dvoid *, dvoid *))0, (size_t)0, (dvoid **)0);

if(errnum) {

Debug(__LINE__,__FILE__,"Initializing to Execute OCIEnvCreate");

return -1;

}

errnum = OCIHandleAlloc((dvoid *)m_pOCIEnv, (dvoid **)&m_pOCIError, OCI_HTYPE_ERROR, (size_t)0, (dvoid **)0);

if(errnum) {

Debug(__LINE__,__FILE__,"Initializing to Execute OCIHandleAlloc");

return -1;

}

errnum = OCIHandleAlloc((dvoid *)m_pOCIEnv, (dvoid **) &m_pOCIServer, OCI_HTYPE_SERVER, (size_t) 0, (dvoid **) 0);

if(errnum != OCI_SUCCESS) {

Debug(__LINE__,__FILE__,"Execute OCIHandleAlloc");

dbReportError(m_pOCIError);

return -1;

}

errnum= OCILogon(m_pOCIEnv, m_pOCIError, &m_pOCISvcCtx, (const OraText*)db_username, strlen(db_username),(const OraText*)db_

password,strlen(db_password), (const OraText*)OracleTnsNames, strlen(OracleTnsNames));

if(errnum) {

Debug(__LINE__,__FILE__,"Initializing to Execute OCILogon");

dbReportError(m_pOCIError);

return -1;

}

errnum = OCIHandleAlloc((dvoid *)m_pOCIEnv, (dvoid **)&m_pOCIStmt, OCI_HTYPE_STMT, (size_t)0, (dvoid **)0);

if ( errnum ) {

Debug(__LINE__,__FILE__,"Execute OCIHandleAlloc");

dbReportError(m_pOCIError);

return -1;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值