ODBC connection in my C++ console application
Posted on 2004-04-23
I am interested in creating a web "turn-based" game. What I want to do is the following:
I want to write a c++ console application that I will set to run at specified times. This console application will connect to my database, which I have already setup. It will read certain data out of the database, like the players orders etc. I am going to write the application so that it creates objects in memory based on certain field data it retrieves and perform actions against those objects, like movement, combat, unit creation etc.
Here is my problem. I have NO IDEA how to get my console application to connect to my database. I will more than likely use ODBC to handle the connection, however all the examples of how to do this are very vague and do not work. I want to avoid using MFC's or 3rd party libraries to handle the connection for me.
Can anyone provide an example of how I might be able to go about doing this. Or can anyone point me to a website that has a WORKING example.
If someone can give me an example of how to perform the connection and possibly a select statement that would be a great help.
I appreciate any help anyone might be able to provide. And no this is not for a school project or anything like that, this is for a personal project I am working to flesh out my DirectX game mechanics before I finish my game engine.
Thanks in advance. Happy programming!