祝愿大家身体健康!

 站点注册  找回密码
 站点注册

QQ登录

只需一步,快速开始

查看: 6121|回复: 4

[转帖]PB8如何使用OLE DB连接到ASA数据库

[复制链接]

[转帖]PB8如何使用OLE DB连接到ASA数据库

[复制链接]
ehxz

主题

0

回帖

58万

积分

管理员

积分
588671
贡献
在线时间
小时
2007-6-26 12:51:34 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?站点注册

×
Connecting to ASA Server (7.01 GA) via OLE DB in PowerBuilder 8
Adaptive Server Anywhere includes an OLE DB provider named ASAProv. One of the features of ASAProv (dboledb7.dll) is that you do not have to deploy ODBC. In other words, you can connect to an ASA database either via OLE DB or via OLE DB/ODBC bridge.
The steps to establish database connection to ASA using OLE DB from PowerBuilder are as follows:
Start ASADEMO as a server by executing the following line at the command prompt:
        dbsrv7 asademo -x tcpip -n asademo

("asademo" - your choice of database server name. Make sure you do not have a similar named server running in your internal network otherwise you will get error running the server)
 

There are two ways of connecting to an ASA server via OLE DB
1) OLE DB/ODBC bridge
For this connection, you have to specify a valid ODBC DataSource in your DBParm. Your connection script will look like this:
        // Profile asa_oledb
        SQLCA.DBMS = "OLE DB"
        SQLCA.LogPass = "sql"
        SQLCA.LogId = "dba"
        SQLCA.AutoCommit = False
        SQLCA.DBParm = "PROVIDER='ASAProv',DATASOURCE='asa'"
 
2) OLE DB (do not have to deploy ODBC)
You can access data from OLE DB by providing connection information in a separate file with a .udl extension. This file is referred to as the Microsoft DataLink (.udl) file. You need to have the Datalink API installed on the system in order to create and use the .udl files.
To create a data link (.udl) file from Windows Explorer - Right-click within the right pane of an Explorer window or from your desktop and select Microsoft Data Link from the New menu. A new data link .udl file will be created in the current directory.
If you do not have the option to select Microsoft Data Link in the New menu, then create a .txt file and rename it to a .udl file. DoubleClick on the file, it will open the file with the options to add the connection information.
For more information please check msdn.microsoft.com and search for atalink?/tt>

In Powerbuilder, when using the datalink file (.udl), make sure that the Catalog Tables have already been created in the database. To verify, you can connect to the database server using an ODBC DataSource instead. If the tables donexist, you should get an error indicating that Catalog Tables were not created.

Create an asademo.udl file with following info:

        Provider Tab:
            Select "Adaptive Server Anywhere Provider"
        Connection Tab:
            Location: eng=asademo;dbn=asademo;Links=TCPIP{};
            Select radio button for se a specific username and password?
            Type Username - dba
                 Password - sql
            Select checkbox - Allow saving password
            Click "Test Connection" to verify the connection.
If you are using the datalink file in PowerBuilder, you cannot use userid and password from PB script or DB profile. You have to save this information in the udl file itself (cr 239454).
In PB, the connection script will look like this:
        // Profile asa_oledb
        SQLCA.DBMS = "OLE DB"
        SQLCA.AutoCommit = False
        SQLCA.DBParm = "PROVIDER='ASAProv',DATALINK='C:\asaole.udl'"
You can also refer to TechDoc # 47903 - Connecting to OLE DB Providers from PowerBuilder 7 and 8
Connecting to ASA Server (7.01 GA) via OLE DB in PowerBuilder 8
Adaptive Server Anywhere includes an OLE DB provider named ASAProv. One of the features of ASAProv (dboledb7.dll) is that you do not have to deploy ODBC. In other words, you can connect to an ASA database either via OLE DB or via OLE DB/ODBC bridge.
The steps to establish database connection to ASA using OLE DB from PowerBuilder are as follows:
Start ASADEMO as a server by executing the following line at the command prompt:
        dbsrv7 asademo -x tcpip -n asademo

("asademo" - your choice of database server name. Make sure you do not have a similar named server running in your internal network otherwise you will get error running the server)
 

There are two ways of connecting to an ASA server via OLE DB
1) OLE DB/ODBC bridge
For this connection, you have to specify a valid ODBC DataSource in your DBParm. Your connection script will look like this:
        // Profile asa_oledb
        SQLCA.DBMS = "OLE DB"
        SQLCA.LogPass = "sql"
        SQLCA.LogId = "dba"
        SQLCA.AutoCommit = False
        SQLCA.DBParm = "PROVIDER='ASAProv',DATASOURCE='asa'"
 
2) OLE DB (do not have to deploy ODBC)
You can access data from OLE DB by providing connection information in a separate file with a .udl extension. This file is referred to as the Microsoft DataLink (.udl) file. You need to have the Datalink API installed on the system in order to create and use the .udl files.
To create a data link (.udl) file from Windows Explorer - Right-click within the right pane of an Explorer window or from your desktop and select Microsoft Data Link from the New menu. A new data link .udl file will be created in the current directory.
If you do not have the option to select Microsoft Data Link in the New menu, then create a .txt file and rename it to a .udl file. DoubleClick on the file, it will open the file with the options to add the connection information.
For more information please check msdn.microsoft.com and search for atalink?/tt>

In Powerbuilder, when using the datalink file (.udl), make sure that the Catalog Tables have already been created in the database. To verify, you can connect to the database server using an ODBC DataSource instead. If the tables donexist, you should get an error indicating that Catalog Tables were not created.

Create an asademo.udl file with following info:

        Provider Tab:
            Select "Adaptive Server Anywhere Provider"
        Connection Tab:
            Location: eng=asademo;dbn=asademo;Links=TCPIP{};

Create an asademo.udl file with following info:

        Provider Tab:
            Select "Adaptive Server Anywhere Provider"
        Connection Tab:
            Location: eng=asademo;dbn=asademo;Links=TCPIP{};

Create an asademo.udl file with following info:

        Provider Tab:
            Select "Adaptive Server Anywhere Provider"
        Connection Tab:
            Location: eng=asademo;dbn=asademo;Links=TCPIP{};
            Select radio button for se a specific username and password?
            Type Username - dba
                 Password - sql
            Select checkbox - Allow saving password
            Click "Test Connection" to verify the connection.
If you are using the datalink file in PowerBuilder, you cannot use userid and password from PB script or DB profile. You have to save this information in the udl file itself (cr 239454).
In PB, the connection script will look like this:
        // Profile asa_oledb
        SQLCA.DBMS = "OLE DB"
        SQLCA.AutoCommit = False
        SQLCA.DBParm = "PROVIDER='ASAProv',DATALINK='C:\asaole.udl'"
You can also refer to TechDoc # 47903 - Connecting to OLE DB Providers from PowerBuilder 7 and 8

共享共进共赢Sharing And Win-win Results
SYBASEBBS - 免责申明1、欢迎访问“SYBASEBBS.COM”,本文内容及相关资源来源于网络,版权归版权方所有!本站原创内容版权归本站所有,请勿转载!
2、本文内容仅代表作者观点,不代表本站立场,作者自负,本站资源仅供学习研究,请勿非法使用,否则后果自负!请下载后24小时内删除!
3、本文内容,包括但不限于源码、文字、图片等,仅供参考。本站不对其安全性,正确性等作出保证。但本站会尽量审核会员发表的内容。
4、如本帖侵犯到任何版权问题,请立即告知本站 ,本站将及时删除并致以最深的歉意!客服邮箱:admin@sybasebbs.com
yesfang

主题

0

回帖

3

积分

新手上路

积分
3
贡献
在线时间
小时
2007-9-4 16:27:34 | 显示全部楼层

我想要中文的。

共享共进共赢Sharing And Win-win Results
ljq900

主题

0

回帖

19

积分

新手上路

积分
19
贡献
在线时间
小时
2007-10-18 14:48:32 | 显示全部楼层

如果用ASA数据库,pb做开发

还是ODBC方便

oledb也没什么特别的

[em01][em01]
共享共进共赢Sharing And Win-win Results
lovelyni

主题

0

回帖

76

积分

注册会员

积分
76
贡献
在线时间
小时
2007-12-19 22:06:13 | 显示全部楼层
........看的头晕,[em01]
共享共进共赢Sharing And Win-win Results
lovelyni

主题

0

回帖

76

积分

注册会员

积分
76
贡献
在线时间
小时
2007-12-19 22:13:22 | 显示全部楼层
我也想要中文的
共享共进共赢Sharing And Win-win Results
您需要登录后才可以回帖 登录 | 站点注册

本版积分规则

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com

QQ|Archiver|PowerBuilder(PB)BBS社区 ( 鲁ICP备2021027222号-1 )

GMT+8, 2024-11-24 12:59 , Processed in 0.036117 second(s), 8 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表