Switch to standard view 
  Sybase logo
 
 
 



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 ?Datalink?

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 don?t exist, 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 ?Use 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


Back to Top
© Copyright 2010, Sybase Inc.