在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
当然,你的服务名,用户名,密码你先要在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
解决方案 »
- 满分求一个简单的oracle函数~~~~!!!本人初学者
- Oracle行转列
- 一个简单的问题,急急急急急急!!!!在线等
- ORACLE 记录类型
- 如何把xls、doc文件以纯粹的二进制文件形式保存到oracle表的某一条记录的一个字段中去?
- 请问,将oracle数据库中表记录导入到Acess表的SQL语句该怎么写啊?谢谢了...全部可用分只剩下这10分了,抱歉..
- 着急,一个导出的文件有5G,可是数据文件最大不能超过4G,如何导入??(解决问题追加50分)
- oracle中多用户的查询语句怎么写
- 请问在VB.net中如何得到oracle过程执行的返回值?谢谢帮助!
- 怎样进行pb6.5和oracle for 95 的连接???
- sql语句过长??
- 请问SQL Expert for Oracle的序列号是多少?
安装好客户端,配置一下即可