18.10.2013 Views

SQL2GMS - GAMS

SQL2GMS - GAMS

SQL2GMS - GAMS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10<br />

<strong>SQL2GMS</strong><br />

To create a new data source, click the Add button, select a driver, give it a name (this is the DSN name)<br />

and configure the data source.<br />

7 Reading from an MS Access Database<br />

There are several ways to export data from an SQL database into a <strong>GAMS</strong> include file:<br />

1. Export a CSV (Comma Separated Values) file using Access Export. See http://www.gams.com/<br />

~erwin/interface/interface.html for an example.<br />

2. Use the MDB2GMS tool.<br />

3. Use <strong>SQL2GMS</strong> with a configured ODBC data source. The connection string will look like: “<br />

DSN=mydsn”.<br />

4. Use <strong>SQL2GMS</strong> with a DSN-less ODBC connection. In this case we need to specify both the<br />

driver and the location of the database file explicitly in the connection string. The connection<br />

string will look like:<br />

“Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\data\mydata.mdb“.<br />

5. Use <strong>SQL2GMS</strong> with an OLE DB driver. The connection string can look like:<br />

“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\data\mydata.mdb“<br />

8 Reading from an MS Excel spreadsheet<br />

There are numerous ways to export data from an Excel spreadsheet into a <strong>GAMS</strong> include file:<br />

1. Export a CSV (Comma Separated Values) file using Excel Export. See http://www.gams.com/~erwin/<br />

interface/interface.html for an example.<br />

© 2010 <strong>GAMS</strong> Development Coorporation

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!