Page 1 of 1

Exporting from GDX to MS Access

Posted: Mon Sep 12, 2022 10:16 am
by Sakib2889
Hello,
I want to export calculated results from GDX to MS Access. But, the database limit is making it difficult to dump all 5 of my parameters into the same MS Access database. Note that MS Access database has a limit of 2 GB. Exporting my first parameter, the GAMS can export no more.
Can I dump one parameter from GDX at a time, meaning can I mention which parameter to export? Or is there better way to retrieve my data?
TIA

Re: Exporting from GDX to MS Access

Posted: Mon Sep 12, 2022 11:04 am
by bussieck
The tool gdx2access exports the entire content of a GDX file to MS-Access, no selection of symbols possible. The solution here would be to generate 5 different GDX files with one symbol per GDX and use gdx2access to create 5 MS-Access databases. You can also try the new GAMS Connect with agent pandasSQLWriter (https://www.gams.com/latest/docs/UG_GAM ... SSQLWRITER) that let's you write directly from GAMS to MS-Access and is highly customizable. You need a 64-bit office or at least the 64-bit MS-Access ODBC driver (explained in the docs).

-Michael

Re: Exporting from GDX to MS Access

Posted: Mon Sep 12, 2022 11:49 am
by Sakib2889
Thank you. I am really a novice in GAMS, in programming as a whole. So, I did not clearly get how I am supposed to code that into my GAMS code. For the first option, I already thought of that but I didn't want to run my optimization again as it takes time. Is there any other way I can retrieve the parameters without running the optimization again. Like is there somewhere the calculated value gets stored when we run an optimization.
Thanks for your time.

Re: Exporting from GDX to MS Access

Posted: Tue Sep 13, 2022 11:58 am
by bussieck
You should look at execute_unload (https://www.gams.com/latest/docs/UG_GDX ... UTE_UNLOAD). If you want to split your existing GDX file, then use "gdxdump my.gdx noData > my.gms" to create a GAMS file my.gms that reads your entire GDX file into GAMS and then have at the end of my.gms a couple of execute_unload statements, one for each symbol.

-Michael