PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Overview
  • Accessing the data files with the HFSQL functions
  • HFSQL functions in a Java project
  • Accessing HFSQL files
  • Configuring the runtime mode of Java applications using HFSQL in MacOSX
  • Accessing a MySQL, SQL Server or SQLite database by JDBC
  • Accessing the data files with the SQL functions
  • Overview
  • SQL functions in a Java project
  • Accessing HFSQL files
  • Accessing a database not in HFSQL format by JDBC
  • Using the Java RAD
  • Available RAD
  • Simple RAD pattern
  • RAD Pattern Compatible Version 11
  • Compilation errors
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
You can start developing your application as soon as the WINDEV project is defined as being a Java project.
All types of databases can be handled in WLanguage:
  • HFSQL database.
  • database not in HFSQL format. This database can be handled by a JDBC driver or by a native access.
To handle these databases, you have the ability to use:
  • The HFSQL functions that allow you to handle the data files directly (HFSQL database, MySQL database accessed by JDBC, SQL Server database accessed by JDBC).
  • The SQL functions that allow you to handle the data files directly (HFSQL database or database accessed by JDBC (MySQL, SQL Server, Oracle, DB2, ...)).
  • The Java RAD , that allows to quickly develop the windows for handling your data files.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Accessing the data files with the HFSQL functions
A JAVA application developed with WINDEV allows you to handle data files regardless of the platform where the Java application is run (Windows, Linux or Mac).
The use of a database from a Java application can be performed by the HFSQL functions. The libraries of the WINDEV Framework being available in these environments, the access to the HFSQL database via the HFSQL functions is immediate.
Note: If "Automatically create the data files if not found when they are opened" is checked (in the description window of the project, "Files" tab), the corresponding data files will be automatically created if necessary.
HFSQL functions in a Java project

Accessing HFSQL files

The method for handling HFSQL files in a Java project is the same as the method for handling HFSQL files in a Windows project.
Depending on the runtime platform (Windows, Linux or MacOSX), the libraries required to access the HFSQL databases may vary. See Managing databases in the WINDEV Java applications for more details.
Note: By default, the data files are installed with the Java archive. However, the data files can be installed in another directory. In this case, you must specify the new path in the application with HChangeDir.

Configuring the runtime mode of Java applications using HFSQL in MacOSX

The libraries used to access the HFSQL databases in MacOSX are supplied in 32 bits only. Make sure that the applications that use them will be run by a virtual Java machine in 32-bit mode.
To do so:
  • In the "Applications" menu, select "Tools .. Java Preferences".
  • In the "Java applications" section, modify the preference order of the virtual machines to place the 32-bit version in first position.
Caution: this modification affects all the Java applications started in command line or via Java Web Start.
The minimum version of MacOSX required for using the HFSQL databases with a Java application is 10.5.8.
WINDEVJavaODBCNative Accesses

Accessing a MySQL, SQL Server or SQLite database by JDBC

To handle the data files described in the analysis of a Java project, you must:
  1. Describe a connection with HDescribeConnection or HOpenConnection. When defining this connection, you must specify the JDBC driver to use.
  2. Associate this connection to the different analysis files with HChangeConnection.
    Example for a connection to a MySQL database:
    HOpenConnection("MyMySQLConnection", "Login", "Password", ...
           "jdbc:mysql://MyServer/MyDatabase", "MyDatabase", ...
            hAccèsJDBCMySQL, 0, "com.mysql.jdbc.Driver")
    HChangeConnection("*", "MyMySQLConnection")

    Example for connecting to a SQLite database:
    SQLiteConnection is Connection

    // Connection parameters
    SQLiteConnection..Provider = hAccessJDBCSQLite
    SQLiteConnection..Server = "jdbc:sqlite:mydatabase.db"
    SQLiteConnection..Access = hOReadWrite
    SQLiteConnection..ExtendedInfo = "org.sqlite.JDBC"
    // Open the connection
    HOpenConnection(SQLiteConnection)

    Notes about the SQLite access:
    • ..Name and ..Password are useless,
    • ..Server is used to configure the location and the name of database file (here: the file is named mydatabase.db and it is found in the runtime directory of application).
  3. When the connection is defined, the HFSQL functions can be used to handle the records found in the data files.
Accessing the data files with the SQL functions

Overview

A JAVA application developed with WINDEV allows you to handle data files regardless of the platform where the Java application is run (Windows, Linux or Mac).
The use of a database from a Java application can be performed by the SQL functions. The libraries of the WINDEV Framework being available in these environments, the access to the HFSQL database via the SQL functions is immediate.
SQL functions in a Java project
WINDEVJavaHFSQLHFSQL Client/Server

Accessing HFSQL files

To handle the HFSQL data files described in the analysis of a Java project, you must:
  1. Describe a connection with SQLConnect. When defining this connection, you must specify the analysis used (.WDD file) as well as the database (HFSQL).
    Example:
    nConnectionNum is int
    nConnectionNum = SQLConnect("JavaClient.wdd", "", "", "", "HYPER FILE", "", "")
  2. When the connection is defined, the HFSQL functions can be used to handle the records found in the HFSQL data files.
Notes:
  • By default, the data files are installed with the Java archive. However, the data files can be installed in another directory. In this case, you must specify the new path in the application with HChangeDir.
  • To access the HFSQL files, the following libraries and the Java archive of the application must be found in the same directory (they are automatically copied by WINDEV during the Java generation):
    • in Windows: wdxxxhf.dll, wdxxxsql.dll, wdxxxjav.dll, wdxxxvm.dll, wdxxxuni.dll. The Windows libraries are found in the "Programs" sub-directory of setup directory of WINDEV.
    • in Linux: wdxxxhf.so, wdxxxsql.so, wdxxxjav.so, wdxxxvm.soSO, wdxxxuni.so. The Linux libraries are found in the "Programs\Framework" sub-directory of setup directory of WINDEV.
    • in MacOSX: wdxxxhf.dylib, wdxxxsql.dylib, wdxxxjav.dylib, wdxxxvm.dylib. The MacOSX libraries are found in the "Programs\Framework" sub-directory of setup directory of WINDEV.
  • The analysis file (WDD file) specified in the syntax of SQLConnect must be accessible from the Java application.
WINDEVJavaODBC

Accessing a database not in HFSQL format by JDBC

To handle the data files described in the analysis of a Java project, you must:
  1. Describe a connection with SQLConnect. When defining this connection, you must specify the analysis used (.WDD file) as well as the database (HFSQL).
    Example for a connection to a MySQL database:
    nConnectionNum is int
    nConnectionNum = SQLConnect("jdbc:mysql://Venus/test", "test", ...
    "mysql", "", "JDBC", DriverNameMysqlName)
  2. Once the connection is established, use the SQL functions to handle the records found in the data files.
Using the Java RAD
WINDEVJavaHFSQLHFSQL Client/ServerNative Accesses

Available RAD

As for any WINDEV project associated with an analysis, the RAD can be used to generate the windows of your Java application.
You have the ability to create form windows, table windows, ... The Java RAD takes into account all the specific features of Java generation (controls, processes, functions that can be used in a WINDEV application generated in Java).
Two types of RAD patterns can be directly used in Java:
  • The simple RAD pattern.
  • The 'Compatible 11' RAD pattern.
    If this pattern is not available, select "Tools .. Options .. Options of the environment". In the "Environment" tab, check "RAD compatible version 11".
The code generated by the other patterns must be adapted to operate in Java.
WINDEVJavaHFSQLHFSQL Client/ServerNative Accesses

Simple RAD pattern

This pattern is adapted for generating a Java application. As for any WINDEV project associated with an analysis, the RAD can be used to generate the windows of your Java application.
Note: By default, the simple RAD pattern handles HFSQL files. If you want to use a connection by JDBC, you must adapt the generated code. To do so, describe the connection to use (HDescribeConnection or HOpenConnection) by specifying the JDBC driver to use. This connection is associated with the different analysis files by HChangeConnection.
Example for a connection to a MySQL database:
HOpenConnection("MyMySQLConnection", "Login", "Password", ...
       "jdbc:mysql://MyServer/MyDatabase", "MyDatabase", ...
        hAccèsJDBCMySQL, 0, "com.mysql.jdbc.Driver")
HChangeConnection("*", "MyMySQLConnection")
WINDEVJavaHFSQLHFSQL Client/ServerNative Accesses

RAD Pattern Compatible Version 11

Regardless of the type of window to generate, the first screen of the wizard is used to specify the type of connection to the database:
  • HyperFileSQL.
  • HFSQL.
  • JDBC.
By selecting "HyperFileSQL", the standard wizard for window creation is proposed.By selecting "HFSQL", the standard wizard for window creation is proposed.
For a connection via a JDBC driver, the next step of the window creation allows you to specify the parameters for connecting to the database using the JDBC driver:
The windows generated by Java RAD use the SQL functions of WLanguage. The connection to the database is performed by SQLConnect.
WINDEVJavaHFSQLHFSQL Client/ServerNative Accesses

Compilation errors

A Java RAD developed in WINDEV 10 or earlier may trigger compilation errors in version 18 for the controls found in the tabs.
To solve these errors, the name of the control must be prefixed by the name of the tab to which it belongs. For example, for a control named "MyControl" that belongs to the tab named "MyTab", use the following notation: "MyTab.MyControl".
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment