Connection Fortran to MySQL database

Is in Fortran possible to connect to a database (e.g. MySQL)?

I want to develop a Fortran calculation application. This application should be able to connect with a MySQL database. The next steps are:

  1. read data from a table by SQL queries,
  2. Execute calculations
  3. Result of these calculations should be stored in the database

Thanks in advance for your help


Welcome @eric.bakker to the Discourse!

Yes, in @Arjen Markus’ book Modern Fortran in Practice, the chapter 6 is “Interfacing to C: SQLite as an example”:
The Fortran code can be found here:


Actually, my Flibs project at contains a module (by Daniel Kraft) for connecting with MySQL directly. It is not as extensive as the SQLite one, but it ought to be useful as a beginning.


Thank you for your reply

1 Like