|
我也提供一份我以前练习的手写ODBC连接ORACLE的脚本,做个和SQL SERVER的比较
vuser_init:
#include "lrd.h"
static LRD_INIT_INFO InitInfo = {LRD_INIT_INFO_EYECAT};
static LRD_DEFAULT_DB_VERSION DBTypeVersion[] =
{
{LRD_DBTYPE_NONE, LRD_DBVERSION_NONE}
};
static void FAR * OraEnv1;
static void FAR * OraSvc1;
static void FAR * OraStm1;
vuser_init()
{
lrd_init(&InitInfo, DBTypeVersion);
lrd_initialize_db(LRD_DBTYPE_ORACLE, 1, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
lrd_logon(OraEnv1, &OraSvc1, "jack", "123456", "TDSERVER", 0); //这是个ORACLE连接,连我自己的机器,服务是TDSERVER,用户是JACK,密码是123456
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
return VUSER_OK;
}
action:
unsigned long uliRowsProcessed;
Action()
{
lrd_ora8_stmt(OraStm1, "select * from user_tables\n", 1, 0, 0);//查user_tables表
lrd_ora8_exec(OraSvc1, OraStm1, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
return VUSER_OK;
} |
|