- Overview
- Setup
- Configuration
- To use the ODBC driver on HFSQL, configure the ODBC driver:
- Use
- Using the ODBC driver on HFSQL from your Java program
- Known problems
Using ODBC on HFSQL Classic via JDBC
 Available only with these kinds of connection
The ODBC driver on HFSQL Classic is used to access an HFSQL Classic database from an external database software that supports ODBC accesses. This gives you the ability to use the ODBC driver on HFSQL via JDBC. It is necessary to use a JDBC driver (Microsoft, Oracle, etc.). The driver is available in read/write. An application written in external language can read and write in HFSQL files. The ODBC driver on HFSQL Classic is a level 2 ODBC driver. See a specific documentation for more details. Setup When installing WINDEV and WEBDEV on the development computer, you have the ability to install the ODBC driver on HFSQL Classic. Furthermore, when configuring the setup program of your WINDEV applications, you have the ability to include the setup of the ODBC driver on HFSQL. To use the ODBC driver on HFSQL, configure the ODBC driver: - Start the ODBC data administrator (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 "HyperFileSQL" driver.
- Click "Done".
- Enter the name of the HFSQL data source. This name will be used to identify the HFSQL database in the external programs.
- Click the "Details" button.
- Click "Browse" to select the WDD file corresponding to the analysis.
- In the list of analyses, select the requested analysis and the directory of the data files ("Browse" button). All the HFSQL data files corresponding to the selected analysis are grouped in this directory.
Caution: a file directory must be selected for each analysis. - Validate ("OK" button).
The database can be used in read-only mode from the external programs via the ODBC driver on HFSQL Classic. Using the ODBC driver on HFSQL from your Java program To use the ODBC driver on HFSQL from your Java program, you must: - Define the driver used. For example, with the following line of code:
// Use the JDBC driver of Microsoft Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver"); // Use the JDBC driver of Sun Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- Define the URL on the system ODBC connection ("hfodbc" for example):
String jURL = "jdbc:odbc:hfodbc"; // Connection Connection Contact = DriverManager.getConnection(jURL, "<user>", "<pass>");
- Interrogate the HFSQL database in SQL. For example:
// Creates a query Statement jQuery = Contact.createStatement(); // Run the query and retrieve ... ResultSet Result = jQuery.executeQuery("SELECT * FROM CUSTOMER"); int jColumn = 5; int jRow = 3; ResultSetMetaData jMetaData= Result.getMetaData(); for (int i=0;i<jRow;i++) Result.next(); System.out.println("Column name: " + jMetaData.getColumnLabel(jColumn)); System.out.println("Value: " + Result.getString(jColumn)); Result.close(); jQuery.close(); Contact.close();
The ODBC driver on HFSQL cannot be used to access an encrypted HyperFileSQL database.
This page is also available for…
|
|
|
|