2024年4月2日发(作者:)

PB如何连接Oracle数据库

在PB中,你只要通过DATABASE选项设置一下你的服务名,用户名,密码就可以连

接上的

当然,你的服务名,用户名,密码你先要在NET ASSISANT中配置好,保证你的连

接是正常的,你就可以连接上你的ORACLE了,在开发的时候,你就要直接设置SQLCA

的连接属性了:

if _logon("", "Database", '') = -1 then

MessageBox('提示信息','数据库连接失败,请检查数据库连接配置!!')

Close(THIS)

return// 1连接成功,-1连接失败

END IF

SQLCA是一个用户定义对象(USER OBJECT),它的OF_LOGON函数如下:

string ls_src,ls_dest

if Len(as_inifile) > 0 then // get information from file

is_idheader = ProfileString(as_inifile, "Server", "id_head", "TCH")

= ProfileString(as_inifile, as_section, "DBMS", "ODBC")

Name = ProfileString(as_inifile, as_section, "Server", "")

se = ProfileString(as_inifile, as_section, "Database", "")

= ProfileString(as_inifile, as_section, "LogID", "sa")

s = ProfileString(as_inifile, as_section, "LogPass",

"811811")

= ProfileString(as_inifile, as_section, "DBParm", "")

if s <> "811811" then

f_decrypt(s, s)

end if

if Len(as_other) > 0 then

if Not Match(Upper(), " +HOST *=") then

= + " host='" + as_other + "'"

end if