MySQL

Started by
10 comments, last by PumpkinPieman 20 years, 5 months ago
Alright, I have really good background with using my sql in web biased languages. But for some reason I can''t find the api for handling MySQL. I went to the website but I have no idea which one to download, and what to do with it. Anyone here dealt with MySQL through C++, that could help me out? Also, any type of tutorials, I searched GameDev, but didn''t find anything of relevence.
Advertisement
If you are in Windows and download/install the mysql package from here then you should already have a /include and a /lib dir that you need to add to your project. All the basic mysql stuff should be there.

-------
Andrew
PlaneShift - A MMORPG in development.
Alright, thank you. Do you happen to know any type of tutorials I can follow to lead me up to creating a connection to a database.
Official documentation of the C API.
http://www.mysql.com/doc/en/C.html

A nice tutorial to get started:
http://www.informit.com/isapi/product_id~{506B247F-BD8F-4D9C-BD62-FE736E57BD7B}/session_id~{1D714069-D6B2-435E-B34E-21E873022053}/content/index.asp

You might want to check out Mysql++ which is a nice C++ wrapper of the C API library, though I wrote my own because I needed something easy to use, and being able to use features that MySQL doesn''t have.
I still don''t get how I can include them to my program, I really havn''t worked much with including libs.
quote:Original post by PumpkinPieman
I still don''t get how I can include them to my program, I really havn''t worked much with including libs.


It depends on your IDE. Usually there should be something in project settings like "Additional Libraries" that you can add in the dir where the MySQL libraries are located. Similar for the includes, there should be something like "Additional Dirs to search for includes" that you can add in the path to the MySQL include files. Read up on your IDE docs on where these exact settings are.



-------
Andrew
PlaneShift - A MMORPG in development.
Well my IDE is VC++.net, I just added the lib by right clicking on the project and adding an existing file. But I don't think that worked. :?

I tried to follow the example they had where they added the lib file, then included mysql.h, but it kept on telling me it couldn't find the header. Although, they're example didn't have it in the dir either.

[edited by - PumpkinPieman on November 15, 2003 5:25:45 PM]
Select Tools->Options. Under "Projects" you'll find a tab "VC++ Directories". Here you can specify in which dirs the compiler/linker will look for various files, including (no pun intended) include and library files.

-Nik

EDIT:
After sorting that out, set the project's linker option "Additional Dependencies" to whatever libs you need.



[edited by - Nik02 on November 15, 2003 5:52:32 PM]

Niko Suni

Hmm, I think I'll get it some time. It's still really confusing.

There is a tutorial here http://www.cpp-home.com/tutorial.php?22_1 But for some reason I can't seem to find the file he is talking about, or atleast it doesn't contain a mysql++.lib

[edited by - PumpkinPieman on November 15, 2003 9:18:36 PM]
quote:Original post by PumpkinPieman
There is a tutorial here http://www.cpp-home.com/tutorial.php?22_1 But for some reason I can''t seem to find the file he is talking about, or atleast it doesn''t contain a mysql++.lib
Now you are mixing up two different APIs. There is the plain standard MySQL C API distributed with the server, and then there is a more obscure MySQL++ API. Even though the latter is supposed to be easier to use in C++, in my opinion the former is simpler. Stick with either.

This topic is closed to new replies.

Advertisement