- Compiler Systems
- Libraries & Tools
- CASE Tools (4)
1988 - 2013
QT software GmbH
Konstanzer Strasse 10
VAT ID: DE240717131
HRB 95526 B Berlin
ForDBC - Fortran Database ConnectivityArt.No.: FORDBC
With ForDBC the Fortran programmer can read and write tables of databases using common SQL commands. ForDBC is based on the ODBC API (ODBC=Open Database Connectivity Standard) which is part of the Microsoft Windows System. And so, any database, which comes with an ODBC driver becomes accesible in your Fortran program. This is the case for databases of manufactures such as Oracle, Microsoft, IBM, Sybase, MySQL. And this is also true for spreadsheets as they are created with Excel oder Lotus.
On Windows an ODBC interface is ready to be used. However the ODBC functions are not easy to access by a Fortran programmer because the documentation and the tools supplied by Microsoft are designed for C/C++ or VB programmers. ForDBC offers help. The Fortran interface provided by ForDBC is complete with respect to the ODBC v3.5 specification. This means that with ForDBC you can call all of these ODBC functions as if they were programmed in Fortran. Furthermore hundredths of ODBC and SQL specific constants are supplied. Simply include in your Fortran program the source line
and you are ready to use the ODBC functions and constants as you find them documented in the Windows ODBC API. This documentation either comes with your compiler (e.g., Compaq Visual Fortran, or Intel Visual Fortran, or Microsoft Visual Studio) or it can be found in the Microsoft Windows Platform Software Development Kit (SDK) which is supplied with most software development tools offered by Microsoft. Or you find it on Microsoft's Developer WebSite. Because getting started with ODBC can be exhausting, ForDBC is equipped with several example programs (completely in Fortran) which show you how to use SQL via ODBC. They demonstrate how to read from or write to tables of a Microsoft Access database or an Excel spreadsheet. Using other databases is principally the same.
ForDBC comes with a compact documentation (PDF) which provides you with the essential information that you need for a quick start into ODBC programming.
Users of Compaq Visual Fortran and Intel Visual Fortran are supplied with a complete workspace (.dsw) and solution (.sln), respectively, which contains several sample projects which show how to access a database in several ways. So, a simple "Build" creates all the examples from scratch. And you are ready to debug them to understand how they work.
For users of Intel Visual Fortran (v11.1 and higher) both 32-bit and 64-bit versions are available. You may want to test how easy ForDBC is installed, used, and you may check its complete functionality:
Download ForDBC Demo (ForDBC_325.zip) appr. 8.3 MB
The ForDBC demo contains the complete ForDBC installation, whose usage is timely restricted. After download, please contact us for the password to un-zip the file. When purchasing ForDBC, you will receive a licence file (by email), which allows ForDBC applications (.exe) to be created without the restrictions the ForDBC demo implies.
For a quick start you will find links to a few videos-tutorials below.
ForDBC provides you a few simple databases - an MS/Excel sheet (ODBCTest.xls) and an MS/Access database (test-db.mdb). The MS/Access database contains a table named "Tabelle1". Its structure and contents:
This table contains 4 columns named "ID", "I4", "DP" and "STR". The example shall demonstrate how to use the common Fortran variable types INTEGER, REAL. DOUBLE PRECISION and CHARACTER. To obtain all values of the table one would perform the SQL command:
SELECT id, i4, dp, str FROM tabelle1
(SQL = Structured Query Language). If you want to execute this command in a Fortran program, then you can do so calling an ODBC function which is made availabe via ForDBC:
iRet = SQLExecDirect( hStmt, &
"SELECT id,i4,dp,str FROM tabelle1"//CHAR(0), &
This executes the SELECT command, but it does not deliver the table's contents. To get this in a Fortran program, the values in the table's rows have to be transferrred into corresponding Fortran variables. We declare these Fortran variables (here in Fortran 77 notation)
DOUBLE PRECISION DP
whose names are simply identical with those of the table's columnsn (for readability reasons). These Fortran variables are bound to column specifications in the SQL command by calling the ODBC function SQLBindCol or SQLBindParameter, respectively. For example:
iRet = SQLBindColI2( hStmt, 1, &
SQL_C_SSHORT, Id, 0, cbFixedId )
binds the first parameter ("id") of the SELECT command to the Fortran variable "Id" (INTEGER*2). If then the ODBC function
iRet = SQLFetch( hStmt )
is executed, the Fortran variable "Id" will hold the value which is found in the current row of the column labeled "id" in table "tabelle1". Internally SQLFetch uses a row cursor which is incremented each time SQLFetch is executed. This means, to get the whole result set of the SELECT command, SQLFetch is to be called repeatedly.
A complete example program which demonstrates how the SELECT command above is programmed in Fortran can be found here.
Illus.: ForDBC example program (T_ODBCAccessRd)
in Visual Studio with Solution- & Server-Explorer
We provide Intel Visual Fortran users with several videos that allow a quick start with ForDBC.
You can either download these .mp4 videos via a right-mouse-click on the video title, or left-mouse-click on the title to start the video in your browser. Under Windows these videos can be viewed in Windows Media Player, for example.
Size / Duration
The video shows the download of ForDBC and its subsequent installation, and describes the structure and its essential elements. Then the start of the MS/Visual Studio Solution is launched in VS2013 shows the automatic conversion of the VS2008 projects.
Introduction into the Usage of ForDBC
By means of ForDBC example Visual Studio projects the structure of the Intel Visual Fortran projects (.vfproj) and their essential compiler and linker properties are shown. After the "Build" of a ForDBC example program that program's process is shown in a debug run and the essential elements of an ODBC program are explained.
Creating an ODBC Datasource
Some ForDBC example programs use ODBC data source names (DSN). This video demonstrates how to define a DSN.
Installation of Microsoft ODBC Drivers
For those who don't own MS/Excel or MS/Access but who nevertheless want to test the ForDBC examples, or those who want to access Excel files (.xls, .xlsx) or Access files (.mdb, .accdb) from within a Fortran program, here you will see from where to download the free ODBC drivers (Microsoft Data Access Components -MDAC for 32-Bit, and MS/Access Runtime Distributables for 64-Bit), and how to install them.
SQL Error [ODBC Microsoft Access Driver]: Unable to open registry key
If an access error due to unsufficient access rights (ACE) occurs when trying to connect to a MS/Access database, this video shows how to change the ODBC access rights in the Windows OS.
Support, Training etc.
If you have questions regarding ForDBC, we would be happy to assist you. We also offer ForDBC trainings or develop ODBC based software, if you prefer to have the database access being programmed in Fortran externally.
Download Delivery and ESD Electronic Software Delivery:
We send a download link, which allows to download the software (incl. documentation). And we deliver a serial number or a license key and if applicable, an installation code.
In case you order support (maintenance), you will obtain the eligibility to download the most recent version of the software for the support period (usually 1 year) and to use it.
Educational License: This license type is available only to educational institutions (schools, colleges, universities). They may not be used for commercial purposes.
Academic License: This license type is available only to academic non-profit organisations (e.g. governmental research institutions). They may not be used for commercial purposes.
Commercial License: Commercial licenses permit a commercial use.
Lizensing: If not specified something else, the software is available only as a single user license for a named user (no networ or multi-user licenses available).