[Tfug] mySQL use
r35157anc3
leo at leosandbox.org
Tue Dec 23 09:42:08 MST 2003
Jim,
I would create an ascii db -> XML object binding in Fortran that is
compliant with the MySQL XML database standard. Then I would dump the
database using a fortran dump program written for the binding, and run
the mysqlimport on the outputted XML.
Also, if you wanted you could write an XML-> some other discipline
binding or an API to create more bindings as needed. That way you could
import it to Berkley DB, etc...
Sounds like a lot of work, but if you already have a dump program or
reporting program written in fortran for the ascii db, all you have to
do is tell it to output in XML instead. Then, you have the option of
writing some super cool SAX handlers or just your regular mysqlimport.
Pretty fast and has good potential for reusability.
&Leo();
Jim Secan wrote:
>I've got some old Fortran code that I need to drag into the late 20th
>century by replacing its clunky old ASCII column-file "databases" with
>mySQL. The problem is the linkage between the code and the database. Two
>generic options I know of: (1) write the interface code in C or C++ using
>the mySQL API library and link these into the Fortran executable (I'm using
>the Lahey compiler), or (2) write from the Fortran into ASCII flat files
>and write some utility codes in whatever language makes sense to load the
>database from these files. Option #2 on the ingest side would just run in
>the opposite direction (utilities to build flat files to be read by the
>Fortran app).
>
>I realize that there are other options using pipes and spawning processes
>from within the Fortran code, but I need this to be portable (*nix and
>windoze) so tricksy OS-specific solutions are verbotten. In a pinch, I
>might consider something along these lines, isolating the OS-specific codes
>in a handful of routines, but this not the preferred approach.
>
>Any experience on which of these alternatives is the least painful? I've
>also heard rumors of linking Fortran and Java (which would be my choice)
>into a single executable, but nothing firm. And no, rehosting the Fortran
>code to some other language is not an option (yet).
>
>TIA, and Merry Christmas.
>Jim
>*---------------------*-------------------------------*
>| Jim Secan | Northwest Research Assoc, Inc |
>| (jim at nwra-az.com) | 2455 E. Speedway, Suite 203 |
>| (520) 319-7773 | Tucson, Arizona 85719 |
>| Space Weather Info: http://www.nwra-az.com/ |
>*---------------------*-------------------------------*
>_______________________________________________
>tfug mailing list
>tfug at tfug.org
>http://www.tfug.org/mailman/listinfo/tfug
>
>
More information about the tfug
mailing list