ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing in Java
  • Overview
  • Accessing data files with HFSQL functions
  • HFSQL functions in a Java project
  • Access HFSQL data 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
  • Access HFSQL data files
  • Accessing a database not in HFSQL format by JDBC
  • Using the Java RAD
  • Available RAD
  • Simple RAD pattern
  • Compilation errors
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview
You can start developing your application once the WINDEV project has been defined as a Java project.
All types of databases can be manipulated in WLanguage:
  • HFSQL database.
  • non-HFSQL database. This database can be handled by a JDBC driver or by a native access.
To manipulate these databases, you can use:
  • HFSQL functions which can be used to manipulate data files directly (HFSQL databases, MySQL or SQL Server databases accessed via JDBC).
  • SQL functions which can be used to manipulate data files directly (HFSQL databases or MySQL, SQL Server, Oracle, DB2, and other databases accessed via JDBC)..
  • The Java RAD tool which lets you quickly expand windows that manipulate your data files.
Accessing data files with 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 the "Automatically create the data files when they are opened" option is checked (in the project description window, "Data files" tab), the corresponding data files will be automatically created if required.
HFSQL functions in a Java project

Access HFSQL data files

Handling HFSQL data files in a Java project is the same as in a Windows project.
Depending on the runtime platform (Windows, Linux or MacOSX), the libraries required to access the HFSQL databases may vary. For more details, see Database management in Java WINDEV applications.
Note By default, 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 minimum version of MacOSX required for using HFSQL databases with a Java application is 10.5.8.
WINDEVJavaODBCNative Connectors (Native 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 with the various data files described in the analysis, using the HChangeConnection function.
    Example for a connection to a MySQL database:
    HOpenConnection("MyMySQLConnection", "Login", "Password", ...
    	"jdbc:mysql://MyServer/MyDatabase", "MyDatabase", hAccessJDBCMySQL, 0, "com.mysql.jdbc.Driver")
    HChangeConnection("*", "MySQLConnection")

    Example for connecting to an 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 have no effect,
    • The Server property is used to configure the location and name of the database file (here: the file is called mabase.db and is located in the application's runtime directory).
  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
WINDEVJavaHFSQL ClassicHFSQL Client/Server

Access HFSQL data files

To manipulate the HFSQL data files described in the analysis of a Java project, simply:
  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.
Remarks:
  • 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 HFSQL data files, the following libraries must be located in the same directory as the application's Java archive (they are automatically copied by WINDEV during Java generation):
    • under Windows: wd300hf.dll, wd300sql.dll, wd300jav.dll, wd300vm.dll, wd300uni.dll. Windows libraries are located in the "Programs" subdirectory of the WINDEV installation directory.
    • under Linux: wd300hf.so, wd300sql.so, wd300jav.so, wd300vm.so, wd300uni.so. The Linux libraries are located in the "Programs\Framework" subdirectory of the WINDEV installation directory.
    • under MacOSX: wd300hf.dylib, wd300sql.dylib, wd300jav.dylib, wd300vm.dylib. The MacOSX libraries are located in the "Programs\Framework" subdirectory of the WINDEV installation directory.
  • 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
WINDEVJavaHFSQL ClassicHFSQL Client/ServerNative Connectors (Native 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 can create form windows, tables, etc. 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).
The "simple RAD" pattern can be used directly in Java.
WINDEVJavaHFSQL ClassicHFSQL Client/ServerNative Connectors (Native 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 manipulates HFSQL data 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 then associated with the various data files described in the analysis using the HChangeConnection function.
Example for a connection to a MySQL database:
HOpenConnection("MySQLConnection", "Username", "Password",  "jdbc:mysql://MyServer/MyDatabase", ...
		"MyDatabase", hAccessJDBCMySQL, 0, "com.mysql.jdbc.Driver")
HChangeConnection("*", "MySQLConnection")
WINDEVJavaHFSQL ClassicHFSQL Client/ServerNative Connectors (Native 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 version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 01/08/2025

Send a report | Local help