Discussion:
porting a Gnat Ada program with ODBC code to Windows
(too old to reply)
Graham Stark
2013-12-20 15:06:44 UTC
Permalink
Hi,
is anyone out there successfully running a Gnat Ada program on Windows which uses the ODBC database drivers?

I've been asked to port this big program:

https://github.com/grahamstark/wales_social_care

to a Windows server but can't get the database connections to work at all, even on simple test programs.

I'm using the original Gnade odbc interface; I *know* there are better alternatives but this was originally written 3 years ago when there weren't and I haven't got time to change it right now (though in retrospect I could probably have ported it in the time I've wasted so far).

I'm developing on an all 32-bit Windows 7 VM, to avoid 32/64 bit mismatches as far as I can.

I have Cygwin installed and have used it to build a clean version of UnixODBC. I've also tried the IODBC libraries that ship with Cygwin.

I get ACCESS_VIOLATION exceptions every time any of the linked to ODBC functions gets called (SQLAllocHandle and so on).

Has anyone got this to work. I just don't know my way around Cygwin and Windows and may well be doing something dumb,

thanks (and happy Christmas)

Graham
Dmitry A. Kazakov
2013-12-20 16:46:21 UTC
Permalink
Post by Graham Stark
is anyone out there successfully running a Gnat Ada program on Windows
which uses the ODBC database drivers?
Yes, of course.
Post by Graham Stark
https://github.com/grahamstark/wales_social_care
to a Windows server but can't get the database connections to work at all,
even on simple test programs.
ODBC connectivity requires configuration of the DSN, user credentials, all
specific to the concrete DBMS and ODBC driver.
Post by Graham Stark
I'm using the original Gnade odbc interface;
GNADE ODBC didn't incorporate changes MS made to the ODBC API, which were
significant. The summary is here:

http://support.microsoft.com/kb/298678
Post by Graham Stark
I have Cygwin installed and have used it to build a clean version of
UnixODBC. I've also tried the IODBC libraries that ship with Cygwin.
It is a quite strange idea to use UnixODBC instead of ODBC32 (native for
Windows). Technically, it should work if you install necessary ODBC drivers
under Cygwin (if you find them) and edit odbc.ini for your DSNs.
Post by Graham Stark
I get ACCESS_VIOLATION exceptions every time any of the linked to ODBC
functions gets called (SQLAllocHandle and so on).
AFAIK, UnixODBC honestly followed MS changes => GNADE ought to be broken
regardless the driver manager and OS you are using.
Post by Graham Stark
Has anyone got this to work.
ODBC works perfectly well with Ada both under Linux and Windows.
Post by Graham Stark
thanks (and happy Christmas)
Same to you.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
l***@gmail.com
2013-12-28 15:59:35 UTC
Permalink
Post by Graham Stark
Hi,
is anyone out there successfully running a Gnat Ada program on Windows which uses the ODBC database drivers?
https://github.com/grahamstark/wales_social_care
to a Windows server but can't get the database connections to work at all, even on simple test programs.
I'm using the original Gnade odbc interface; I *know* there are better alternatives but this was originally written 3 years ago when there weren't and I haven't got time to change it right now (though in retrospect I could probably have ported it in the time I've wasted so far).
I'm developing on an all 32-bit Windows 7 VM, to avoid 32/64 bit mismatches as far as I can.
I have Cygwin installed and have used it to build a clean version of UnixODBC. I've also tried the IODBC libraries that ship with Cygwin.
I get ACCESS_VIOLATION exceptions every time any of the linked to ODBC functions gets called (SQLAllocHandle and so on).
Has anyone got this to work. I just don't know my way around Cygwin and Windows and may well be doing something dumb,
thanks (and happy Christmas)
Graham
Qt5Ada supports ODBC, mySQL,OCI and SQLite database connections
http://users1.jabry.com/adastudio/index.html

Loading...