AMPL Linux: no odbc handler

55 views
Skip to first unread message

st.l...@gmail.com

unread,
Feb 18, 2015, 11:46:36 AM2/18/15
to am...@googlegroups.com
Hello,

what can be the reason in AMPL that I have a tableproxy handler but no odbc handler active in ampl?

Here is the output:

ampl: display _HANDLERS;
set _HANDLERS := tab bit tableproxy;

I have the ampltabl.dll in the same directory and it seems like it only loads the tableproxy handler. Any hints how to fix this? I would like access to my MySQL database. I'm running a 64bit Linux Mint and 'AMPL Student Version 20140226 (Linux x86_32).
Does this even work with 64bit myODBC Linux drivers?

Victor

unread,
Feb 18, 2015, 12:51:45 PM2/18/15
to am...@googlegroups.com
For some reason my answer appeared as a separate post: https://groups.google.com/forum/#!topic/ampl/a2hf5-P2Kjw

Stefan Lendl

unread,
Feb 18, 2015, 3:57:27 PM2/18/15
to am...@googlegroups.com
Thanks a lot that seems to work now without problems. But now when running in verbose mode ampl is complaining that libmyodbc.so is not available:

errmsg = "[unixODBC][Driver Manager]Can't open lib 'libmyodbc.so' : file not found"

But I have libmyodbc installed and the file is located in /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Is ampl expecting the library to be located somewhere else?

Thanks.

Stefan Lendl

unread,
Feb 18, 2015, 4:13:19 PM2/18/15
to am...@googlegroups.com
Just to update my post it seems somehow strange that dll on ampltabl.dll doesn't list libmyodbc.so (I'm using the new Version of ampltabl.dll which now got me one step further):

➜  diet-sql-example  ldd -v /usr/bin/ampltabl.dll   
linux-gate.so.1 =>  (0xf77c4000)
libodbc.so.1 => /usr/lib/i386-linux-gnu/libodbc.so.1 (0xf770e000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf755f000)
libltdl.so.7 => /usr/lib/i386-linux-gnu/libltdl.so.7 (0xf7553000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7537000)
/lib/ld-linux.so.2 (0xf77c7000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7532000)

Version information:
/usr/bin/ampltabl.dll:
libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6
/usr/lib/i386-linux-gnu/libodbc.so.1:
libpthread.so.0 (GLIBC_2.0) => /lib/i386-linux-gnu/libpthread.so.0
libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/i386-linux-gnu/libc.so.6
/lib/i386-linux-gnu/libc.so.6:
ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
/usr/lib/i386-linux-gnu/libltdl.so.7:
libdl.so.2 (GLIBC_2.1) => /lib/i386-linux-gnu/libdl.so.2
libdl.so.2 (GLIBC_2.0) => /lib/i386-linux-gnu/libdl.so.2
libc.so.6 (GLIBC_2.3.4) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6
/lib/i386-linux-gnu/libpthread.so.0:
ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
libc.so.6 (GLIBC_2.3.2) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2) => /lib/i386-linux-gnu/libc.so.6
/lib/i386-linux-gnu/libdl.so.2:
ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
libc.so.6 (GLIBC_PRIVATE) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1.3) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.1) => /lib/i386-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/i386-linux-gnu/libc.so.6

victor.z...@gmail.com

unread,
Feb 18, 2015, 5:32:09 PM2/18/15
to am...@googlegroups.com
The problem is that you are trying to use 64-bit MySQL ODBC driver with 32-bit version of AMPL & ODBC. The easiest way to fix this is to switch to install 32-bit version of MySQL ODBC driver:

  $ sudo apt-get install libmyodbc:i386

Otherwise, you should use tableproxy to connect 32-bit AMPL to 64-bit ODBC driver as described in http://www.ampl.com/NEW/TABLEPROXY/

HTH,
Victor

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

victor.z...@gmail.com

unread,
Feb 18, 2015, 5:34:50 PM2/18/15
to am...@googlegroups.com
ampltabl.dll doesn't have to list libmyodbc.so because it is loaded dynamically by libodbc.so.1 using dlopen or equivalent.

HTH,
Victor

--

Stefan Lendl

unread,
Feb 18, 2015, 5:59:24 PM2/18/15
to am...@googlegroups.com
Thanks, installing the 32-bit version of MySQL ODBC driver helped. Now everything works like expected.

Do I understand it correctly that the best practice would be to use a 64-bit Version of AMPL, but that is not available as a student version?

Thanks a lot for the great support,
Stefan

victor.z...@gmail.com

unread,
Feb 18, 2015, 6:21:46 PM2/18/15
to am...@googlegroups.com
Running 64-bit version of AMPL on a 64-bit platform is a natural thing to do, although since you made 32-bit version work I'd leave it as is.

You can download 64-bit student version of AMPL aka demo version from http://ampl.com/try-ampl/download-a-demo-version/. Please note, however, that ampltabl.dll included in the demo packages for Linux are not compiled with ODBC support for compatibility with systems that don't have ODBC installed. So you'll have to replace it with the one from http://ampl.com/resources/database-and-spreadsheet-table-handlers/#Linux.

Victor
Reply all
Reply to author
Forward
0 new messages