Ready to get started?

Learn more about the CData ODBC Driver for FedEx or download a free trial:

Download Now

Connect to FedEx Data from PowerBuilder

This article demonstrates how to use the CData ODBC Driver for FedEx to connect to FedEx data and execute queries in PowerBuilder.

The CData ODBC Driver for FedEx can be used from any platform or development technology that supports ODBC, including Sybase PowerBuilder. This article shows how to connect to FedEx data and execute queries from the Database Painter and controls such as the DataWindow.

Create a Profile for the ODBC Driver for FedEx

Follow the steps below to use the Database Painter tool to create a database profile based on an ODBC DSN (data source name) for FedEx. In the Database Painter, you can use wizards and the UI to work with FedEx data.

  1. If you have not already done so, create an ODBC DSN for FedEx. The DSN contains the connection properties required to connect to FedEx data. You can use the Microsoft ODBC Data Source Administrator to create and configure DSNs. This is the last step of installing the driver. Required connection properties are the following:
    • Server
    • DeveloperKey
    • Password
    • AccountNumber
    • MeterNumber
    • PrintLabelLocation
    • CacheProvider
    • CacheConnection

    There are five pieces of information needed in order to authenticate its actions with the FedEx service. This information is below.

    • Server: This controls the URL where the requests should be sent. Common testing options for this are: "https://gatewaybeta.fedex.com:443/xml", "https://wsbeta.fedex.com:443/xml", "https://gatewaybeta.fedex.com:443/web-service", and "https://wsbeta.fedex.com:443/web-service"
    • DeveloperKey: This is the identifier part of the authentication key for the sender's identity. This value will be provided to you by FedEx after registration.
    • Password: This is the secret part of the authentication key for the sender's identity. This value will be provided to you by FedEx after registration.
    • AccountNumber: This valid 9-digit FedEx account number is used for logging into the FedEx server.
    • MeterNumber: This value is used for submitting requests to FedEx. This value will be provided to you by FedEx after registration.
    • PrintLabelLocation: This property is required if one intends to use the GenerateLabels or GenerateReturnLabels stored procedures. This should be set to the folder location where generated labels should be stored.

    The Cache Database

    Many of the useful tasks available from FedEx require a lot of data. To ensure this data is easy to input and recall later, utilizes a cache database to make these requests. You must set the cache connection properties:

    • CacheProvider: The specific database you are using to cache with. For example, org.sqlite.JDBC.
    • CacheConnection: The connection string to be passed to the cache provider. For example, jdbc:sqlite:C:\users\username\documents\fedexcache.db
    See the help documentation for a guide to creating a FedEx DSN.
  2. In PowerBuilder, click Tools -> Database Painter.
  3. In the Objects window in the Database Painter, right-click the ODBC node and click New Profile.
  4. On the Connection tab, enter a name for the profile and select the FedEx DSN in the Data Source menu.
  5. To view and modify a table, right-click a table and then click Edit Data -> Grid.

Using FedEx Data with PowerBuilder Controls

You can use standard PowerBuilder objects to connect to ODBC data sources and execute queries. The following example shows how to retrieve FedEx data into a DataWindow. You can add the following code to the open method:

SQLCA.DBMS = "ODBC" SQLCA.DBParm = "ConnectString='DSN=CData FedEx Source'" CONNECT USING SQLCA; dw_senders.SetTransObject(SQLCA); dw_senders.Retrieve();
 
 
ダウンロード