ms access like calls (ie openrecordset) to Mysql in c program include database,h
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ms access like calls (ie openrecordset) to Mysql in c program include database,h
I am migrating a cgi program in c that accesses MySQL 3.22 from Redhat 7to MySQL 5 to latest version of Centos. The c program includes a file database.h. The calls to MySQL include OpenDatabase, OpenRecordset, CloseRecordset. These calls are like Ms Access.
Does anyone know of a library defined by database.h that converts ms access calls to MySQL calls? Any thoughts?
Last edited by pjlinux100; 02-08-2008 at 03:57 PM.
Reason: error
I'm not sure what you mean by "like MS Access". Those are rather
generic terms in the database world, and I'd expect to see those
(or similarly named) functions in pretty much any low-level inter-
face to any database product (not that I personally think of access
as such). In light of this I can't see a need for a "conversion
tool for calls".
But maybe I misunderstood you all together? If so please re-phrase
your question.
Cheers,
Tink
P.S.: This thread seems better of in Programming, and I'm moving
it there to give it the exposure it deserves.
In the C programming-language, such things would be very hard to come by, because that language does not know about objects.
In the C++ programming-language, and higher-level languages such as Perl, Python, PHP, and Ruby (quite likely all of which are also supported by your Linux installation!), these ways of dealing with a database are quite routine. (Note that Visual Basic syntax is not used.)
Hi Guys, thanks for the comments. The problem I have is that these calls opendatabase openrecordset etc do not seem to be supported in the Mysql C API. Quite different methods are used. Were these calls changed in later versions of MySQL or am I missing something? The clue is the header file database.h. What does this header file relate to?
I really don't want to rewrite the program because these calls work just fine with the older version of MySQL. I just cannot bring myself to believe that such a radical change would occur in the methods of talking to MySQL.
DAO was primarily designed for use with Visual Basic (although it can be called from C, C++ or just about any other language), and uses ODBC to communicate with the underlying database.
It's successor was "ADO" (which used OleDB to talk to the database), and ADO's successor is ADO.Net (similar name; completely different technology).
All of these Microsoft APIs (DAO, ADO and ADO.Net) were designed primarily for Microsoft programming environments (notably, VB) and Microsoft Windows.
AFAIK, there isn't a corresponding DAO library for Linux. But it should be relatively straightforward to port to either the MySQL API (which will work on Windows or Linux ... but only with MySQL), or a good ODBC library (which will work anywhere):
Hi Guys,
Thanks for the advice. This is so close. Again the clues to the api used is database.h and that the api is currently used by the old c program so it must be for linux.
My first impulse now is to tell you to simply look
for that header-file on the system, and see what it
says it belongs to in its comments .... or did you
already?
Please let me restate the point I was trying to make:
* "OpenDatabase()" and "OpenRecordset()" were *never* part of any mysql library. They're from Microsoft's DAO. DAO supports many different databases - but only on Windows. DAO is now obsolete - even in Microsoft-Land.
* "mysql_init()" and "mysql_fetch_row()" are from the MySQL library. They work on Linux or Windows; they're probably very similar (identical?) between MySQL 3 and MySQL 5.
* "database.h" is a Microsoft header for the Microsoft DAO library.
It can be found in the Microsoft directory "c:\Program files\<Visual Studio>\<vcxx>\Include". It cannot be used outside of Visual Studio.
So basically, your choices are:
a) Find a DAO library for Linux
... or ...
b) Port the DAO code to a different library
I think "b)" is probably easiest, and probably not terribly difficult.
Many thanks for the contributions. Tink, unfortunately I do not have the original development environment.
PSM, 1 will pursue option (a) first for the fundamental reason that it must exist because it was used in the existing c on linux. I suspect it was used in this c program because the programmer was comfortable with those data base constructs. Maybe that need still exists.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.