马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
这是我第一次在自己的BLOG上发文,经过多次试验,终于用SETUP FACTORY成功的为PB程序打包。
SETUP FACTORY是一个非常简单的打包工具,本次打包的难点在于注册数据源(对于我来说!)
1、在脱离PB的环境下所需要的支持文件:
PB8的供参考:
序 文件名 日期 大小(KB) 作用 1 PBVM80.dll 01-05-25 4,405 PowerBuilder虚拟机,必须的 2 LIBJCC.dll 01-05-25 230 必须的??? 3 PBDWE80.dll 01-05-29 2,092 数据窗口和报表 4 PBRTC80.DLL 01-05-25 873 丰富文本 5 PBAEN70.tlb 01-05-25 4 OLE自动服务器 6 PBODB80.dll 01-05-25 476 Powersoft ODBC接口 7 PBODB80.ini 01-05-25 67 Powersoft ODBC接口 8 DBENG7.exe 00-06-24 41 Adaptive Server Anywhere DataBase访问 9 DBODBC7.dll 00-06-24 500 10 PBMSS80.dll 01-05-25 258 MS SQL Server 6.5 后台数据库访问 11 NTWDBLIB.dll 96-12-17 270 12 NTWDBLIB.dll 00-08-17 272 MS Server 2k(打sp3后一定要用新版003-04-07) 13 DBNETLIB.dll 00-08-06 84 MS Server 2k 打sp3后用到) 14 DBBACKUP.exe 00-06-24 91 Adaptive Server Anywhere DataBase备份 15 DBLIB7.DLL 00-06-24 375
其中可能有多余的。这些文件在PB的安装目录下的Shared\PowerBuilder文件夹和SQL Anywhere 9\win32文件夹下均可找到。
2、在安装目录下建立文件config.ini,文件内容为: [database] dsn=test //根据具体的数据改变数值 uid=dba pwd=sql 在APPLICATION中输入: //从Config.ini文件中读取ODBC数据源信息 string lsDSN,lsUID,lsPWD lsDSN = ProfileString("Config.ini","database","dsn","none") lsUID = ProfileString("Config.ini","database","uid","none") lsPWD = ProfileString("Config.ini","database","pwd","none") // SQLCA配置 SQLCA.DBMS = "ODBC" SQLCA.AutoCommit = False SQLCA.DBParm = "Connectstring='DSN="+lsDSN+";UID="+lsUID+"WD="+lsPWD+"'" 3、在SF的“操作”-“关机时”代码栏中输入:(要读懂这些代码的大致意思,以便根据具体情况修改) -- 从注册表中导入的值: local AppDir = SessionVar.Get("%AppFolder%"); if (not Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0")) then Registry.CreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0") Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Driver", AppDir.."\\dbodbc8.dll", REG_SZ) Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Setup", AppDir.."\\dbodbc8.dll", REG_SZ); Registry.CreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers") Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers", "Adaptive Server Anywhere 9.0", "Installed", REG_SZ); end local dsnName = "test"; --判段ODBC数据源是否存在,如果存在则改名,自动在原名字上加"1" while Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName) do dsnName = dsnName.."1" end --修改注册表,注册ODBC数据源 Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName) Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Driver", AppDir.."\\dbodbc9.dll", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "UID", "dba", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "PWD", "sql", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Description", "", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "DatabaseFile", AppDir.."\\test.db", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "AutoStop", "Yes", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Integrated", "No", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Debug", "No", "REG_MULTI_SZ"); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "DisableMultiRowFetch", "No", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Compress", "No", REG_SZ); Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\ODBC Data Sources", dsnName, "Adaptive Server Anywhere 9.0", REG_SZ); --修改ini文件 INIFile.SetValue(SessionVar.Expand(AppDir.."\\Config.ini"), "database", "DSN", dsnName);
-- 在所有其他"关机时"操作之后在结束时调用该函数。 -- 如果需要的话,这将导致系统重新启动。 -- 定义 _SUF70_Global_Functions.lua -- 不要编辑该脚本,除非您知道您所做的 g_HandleSystemReboot(); 4、在SF的“卸载”-“卸载前”的代码栏中输入:(要读懂这些代码的大致意思,以便根据具体情况修改) --系统文件夹 local AppDir = SessionVar.Get("%AppFolder%"); local productName = SessionVar.Get("%ProductName%");
--确定是否删除ASA注册 if Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Driver",false) == AppDir.."\\dbodbc9.dll" and Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Setup",false) == AppDir.."\\dbodbc9.dll" then Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0"); Registry.DeleteValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers", "Adaptive Server Anywhere 9.0"); end --删除ODBC数据源 local dsnName = INIFile.GetValue(AppDir.."\\Config.ini", "database", "dsn"); if Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName) and dsnName ~= "" then Registry.DeleteKey(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName); Registry.DeleteValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\ODBC Data Sources", dsnName); end |