如何在PB中用直连驱动联接数据库

2025-03-17 23:41:28
推荐回答(2个)
回答1:

连接方法都一样,设置连接参数,然后使用Connect( )函数连接:

//SQL直连
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "glkf"
SQLCA.LogPass = <********>
SQLCA.ServerName = "127.0.0.1"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""

// ODBC连接
SQLCA.DBMS = "ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='DSN=EAS Demo DB V9;UID=dba;PWD=sql'"

只是,ODBC需要先在windows的ODBC管理中、或注册表添加添加连接配置,所以相对来说直连要更方便。

回答2:

1. 确认PB和数据库的客户端软件都是32位的或都是16位的。
2. 将PB的运行环境的路径(5.0 32-bit long name: \Program Files\CommonFiles\Poweresoft Shared, 5.0 32-
bit short name或5.0 16-bit: \pwrs\sys32,6.0: \Program Files\Powersoft\shared)加到机器的系统路径中
(autoexec.bat中的path)。
3. 将数据库的客户端软件的DLLs所在的路径(如Sybase Open Client的路径sybase\bin, Oracle SQL*NET的路径 \orawin\sys32)加到机器的系统路径中。