help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Testing glpk-4.26-tab


From: vijay patil
Subject: Re: [Help-glpk] Testing glpk-4.26-tab
Date: Sun, 2 Mar 2008 00:04:20 +0530

On Sat, Mar 1, 2008 at 6:13 AM, glpk xypron <address@hidden> wrote:
> Hello Vijay,
>
>  I have updated my tentative SQL implementation to reflect the missing 
> includes and changing the paths to the includes (replacing mysql/mysql.h by 
> mysql.h).
>
>  ftp://glpk.dyndns.org/glpk/glpk-4.26-tab_r124.tar.gz


I spent some time testing glpk-4.26-tab_r124.tar.gz on Windows XP
using MS Visual Studio. Please note I did not use batch files in w32
directory for compilation, I usually prefer to set project properties
manually in MS VS.

I. Using MySQL (On Windows XP)
--------------------------------------------------------------
Preprocessor definitions: HAVE_MYSQL
As reported earlier this linking with MySQL C API work fines.

Header files includes added in glpsql02.c are useful to get rid of
compile errors in Windows.
Successfully created glpsol exe and run example transp_mysql.mod. I
have not tried any other example yet.


II. Using ODBC (On Windows XP)
--------------------------------------------------------------
1. I installed MySQL ODBC connected (i.e. MySQL driver/libraries for
ODBC) from http://dev.mysql.com/downloads/connector/odbc/5.1.html

2. Create a user or system DSN for MySQL using administrative tools to
manage ODBC. Here you can specify database name, user name, password.
Test DSN, make sure it is successfully created.

2. Add preprocessor definitions: HAVE_IODBC;HAVE_WINDOWS_H;
Remove/undefine HAVE_MYSQL.

3. Add following line to file glpsql.h. For some reason if without
line below, strange things happen and simple C programs using ODBC API
did not work.

#define SQL_NOUNICODEMAP

4. Try compiling. You may wonder about ODBC library (odbc32.lib) and
header files. They are automatically found and linked in MS VS.
In case you are curious:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
The DLL is in C:\windows\system32\ODBC32.dll

5. Copy transp_mysql.mod  to something like transp_odbc.mod. Made
changes to specify use of ODBC. For example:

table plants IN "ODBC"
  'DSN=dsnmysql'
  'SELECT PLANT, CAPA AS CAPACITY FROM transp_capa' :
   I <- [ PLANT ], a ~ CAPACITY

I successfully created glpsol exe and run example transp_mysql.mod. I
have not tried any other example or any other database (other than
MySQL) yet.

Xypron:
Please see section II.3 if you get a chance.

Summary:
===========
Since ODBC is standard, so glpk support for ODBC should work on
Windows and Gnu/Linux, as long as correct ODBC manager implementations
are available. Code glpk-4.26-tab_r124.tar.gz seems to be working on
Windows, some more testing might be needed.
The advantage of using ODBC is database independence. ODBC manager can
create DSN for any database s/w, as long as the database s/w provides
correct drivers/connectors. So glpk code remains database independent.

-- 
Vijay Patil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]