在PB中,你只要通过DATABASE选项设置一下你的服务名,用户名,密码就可以连接上的
当然,你的服务名,用户名,密码你先要在NET ASSISANT中配置好,保证你的连接是正常的,你就可以连接上你的ORACLE了,在开发的时候,你就要直接设置SQLCA的连接属性了:if sqlca.of_logon("dbserver.ini", "Database", '') = -1 then 
MessageBox('提示信息','数据库连接失败,请检查数据库连接配置!!')
Close(THIS)
return// 1连接成功,-1连接失败
END IFSQLCA是一个用户定义对象(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") This.DBMS = ProfileString(as_inifile, as_section, "DBMS", "ODBC")
This.ServerName = ProfileString(as_inifile, as_section, "Server", "")
This.Database = ProfileString(as_inifile, as_section, "Database", "")
This.LogID = ProfileString(as_inifile, as_section, "LogID", "sa")
This.LogPass = ProfileString(as_inifile, as_section, "LogPass", "811811")
This.DBParm = ProfileString(as_inifile, as_section, "DBParm", "") if This.LogPass <> "811811" then
f_decrypt(This.LogPass, This.LogPass)
end if

if Len(as_other) > 0 then
if Not Match(Upper(This.DBParm), " +HOST *=") then
This.DBParm = This.DBParm + " host='" + as_other + "'"
end if
end if
else // get information from parameter
uo_token luo_token luo_token.of_setseparator("~t") This.DBMS = luo_token.of_getfirsttoken(as_other)
This.Database = luo_token.of_getnexttoken()
This.ServerName = luo_token.of_getnexttoken()
This.LogID = luo_token.of_getnexttoken()
This.LogPass = luo_token.of_getnexttoken()
This.Lock = luo_token.of_getnexttoken()
This.DBParm = luo_token.of_getnexttoken() luo_token.of_setseparator("")
end ifif Match(Upper(This.DBParm), " +PWENCRYPT *=") then
Long ll_pos ll_pos = Pos(Upper(This.DBParm), "PWENCRYPT")
This.DBParm = Replace(This.DBParm, ll_pos, 9, "Encrypt")
end ifSetPointer (HourGlass!)
Connect Using This;
SetPointer (Arrow!)This.LogPass = ""
if This.SQLCode <> 0 then
This.of_error(f_select_message("不能连接数据库;Can't connect database"))
return -1
else
choose case Upper(Left(This.DBMS, 3))
case "ODB"
il_dbtype = DB_ODBC
case "MSS"
il_dbtype = DB_SQLSERVER
case "O73", "O84"
il_dbtype = DB_ORACLE
execute immediate "alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss'" using this;
case "SYC"
il_dbtype = DB_SYBASE
case else
il_dbtype = DB_UNKNOWN
end choose
end ifil_spid = of_getspid()
il_id = 0This.Autocommit = Falsereturn 1