1. 使用Instant Client,相关地址:
http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html
步驟:
1. 复制文件
2. 设置环境变量ORACLE_HOME, NLS_LANG, TNS_ADMIN
3. 将安装目录加入PATH
3. 编辑TNSNAMES.ORA
PB代碼示例:
// Profile
SQLCA.DBMS = "O10 Oracle10g (10.1.0)"
SQLCA.LogPass = "DB_PASSWORD"
SQLCA.ServerName = "TNSNAME"
SQLCA.LogId = "DB_USERNAME"
SQLCA.AutoCommit = False
SQLCA.DBParm = "PBCatalogOwner='DB_USERNAME'"
優點: InstantClient 解压后,配置path环境变量和tnsnames.ora/sqlnet.ora文件即可使用, 不需安装oracle客户端.
2. 使用ODAC组件,即Oracle数据访问组件,来提供Oracle for ADO.NET的功能;这个组件的下载地址是: http://www.oracle.com/technology/global/cn/software/tech/windows/odpnet/utilsoft.html
PB代碼示例:
// Profile
SQLCA.DBMS = "ADO.Net"
SQLCA.LogPass = "DB_PASSWORD"
SQLCA.LogId = "DB_USERNAME"
SQLCA.AutoCommit = False
SQLCA.DBParm = "Namespace='Oracle.DataAccess.Client',Database='DB_USERNAME',DataSource='TNSNAME',ADORelease='10.1.0.301',PBCatalogOwner='DB_USERNAME'"
優點: 可以使用到.NET FrameWork2.0中的数据库连接缓冲池(和J2EE应用服务器中显示管理数据库连接缓冲不同,.NET FrameWork2.0中的数据库连接缓冲池是自动管理的),使连接到数据库上的物理连接数大大减少,从而减轻数据库的压力.