- Configuring the ODBC administrator
- Importing the structure of files
- The import steps
- Taking into account the evolution of the Progress database
- 1. Establishing the connection
- 2. Running queries
- 3. Retrieving the result
- 4. Closing the connection
Native Progress access: Programming with HFSQL functions
Available only with this kind of connection
To use a Progress database with the Native Access, you must:
- Configure the ODBC administrator.
- Import the structure of Progress tables into the WINDEV or WEBDEV analysis.
Differences compared to SQL programming: The queries are not required to handle the Progress data. Indeed, the HFSQL functions can be directly used to read data, perform searches, implement filters, ... However, the structure of Progress files must be imported into the WINDEV or WEBDEV analysis.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Configuring the ODBC administrator
To configure the ODBC administrator:
- Start the administrator of ODBC data (ODBCAD32.EXE) on your computer. To do so, select "Start .. Run" from Windows and type "ODBCAD32.EXE".
- Select the "User database" tab.
- Click the "Add" button.
- Select the ODBC driver for Progress (installed with the client version of Progress).
- Click "Done".
- Enter the name of the Progress data source. This name will be used to identify the Progress database in your WINDEV programs or in your WEBDEV sites.
- Validate ("OK" button).
You have the ability to connect to a Progress database without declaring the ODBC source. In this case, all the connection parameters must be supplied by HOpenConnection
For example, to access the "sports" database located on the "Mars" server, using the "srv_sports" service, the syntax of HOpenConnection
// Define a connection
// Or even better: use the name of the connection defined in the analysis
// (in this case, don't declare the object here)
ctProgress is Connection
// Name of Progress server
ctProgress..Server = "Mars"
// Name of the database
ctProgress..Database = "Sports"
// User of the database
ctProgress..User = "sysprogress"
// Password of the database
ctProgress..Password = "xxxx"
// Native Progress access
ctProgress..Provider = hNativeAccessProgress
// Extended information to specify the port and location of the Progress client layer
cntProgress..ExtendedInfo = "PORT=srv_sports"
// Test of the connection to the database
IF not HOpenConnection(ctProgress) THEN
Error("Failure connecting to the database", HErrorInfo())
Importing the structure of files
The import steps
To perform this import:
- Open the data model editor ("Project .. Load the analysis"). Start the data model editor: click among the quick access buttons.
- In the data model editor, select "Structures of files .. Import the descriptions of files/tables".On the "Analysis" pane, in the "Creation" group, expand "Import" and select "Import the descriptions of files/tables".
- The wizard starts. A connection to the Progress database is automatically established and associated with the files imported into the analysis. This connection will be used to handle the Progress data file by programming.
In the different wizard screens, choose the following options:
In the different wizard screens, choose the following options:
- Data source: External database
- The data in current format will be used by the application
- Select "Native Progress Access", the data source (defined in the ODBC administrator), the user name and the password.
- When the connection is established, all you have to do is select the tables that will be imported into the WINDEV or WEBDEV analysis. These tables can be handled by programming with the HFSQL functions of WINDEV or WEBDEV. These tables will be displayed in blue in the data model editor.
- Database Type: Progress.
- Characteristics of the connection: Data server, User and password, database.
- The application will access the data in the current format.
- When the connection is established, all you have to do is select the tables that will be imported into the WINDEV/WEBDEV analysis. These tables can be handled by programming with the HyperFileSQL functions of WLanguage. These tables will be displayed in blue in the data model editor.
If an ODBC source was defined, there is no need to specify all the parameters in the connection (only the data source defined in the ODBC administrator is required).
If no ODBC source was defined, you must enter all the parameters in the connection:
- Number or name of service onto which the database will answer. This information must be entered in the advanced parameters of the connection (extended information), ...
Taking into account the evolution of the Progress database
To take into account the evolutions of tables imported into the data model editor, select "Structure of files .. Synchronize the analysis with the external databases".
To take into account the evolutions of the tables imported into the data model editor, on the "Analysis" pane, in the "Analysis" group, expand "Synchronization" and select "Update the analysis from the external databases".
A wizard starts, allowing you to:
- analyze the differences for the imported tables only.
- analyze the differences for all the Progress tables.
1. Establishing the connection
To establish the connection to the Progress database, use HOpenConnection
and specify the name of the connection to open. The connection name was defined when importing the structure of files into the analysis.
To modify some parameters of this connection (user name or password for example), call HConnect
: If you try to read the file directly (HReadFirst
, ...), the connection associated with the file description in the analysis will be automatically opened.
2. Running queries
- HExecuteQuery: is used to run a preset query with the query editor of WINDEV and WEBDEV.
- HExecuteSQLQuery: is used to run a query by specifying the SQL code of query and the name that will be assigned to this SQL code.
// Initialize the "Customer_84" query
HExecuteSQLQuery(QryCustomer, "MyProgressDatabase", hQueryWithoutCorrection, ...
"SELECT NAME FROM CUSTOMER")
4. Closing the connection
is used to close the connection to the database when all the necessary queries have been run.
This page is also available for…
Click [Add] to post a comment