Hi;

I am making one small application which can store data to my online mysql server. But with c++ win32 how can I do it?

Please help me.

Recommended Answers

All 6 Replies

You can use ODBC function calls -- there are some online tutorials, just google for it. Or you can install and use MySQL++ which is a c++ wrapper for all MySQL functions. Again, google will point you to the download area.

yes, but does it has to be installed on clients machine too??? because My friends will be using that application too.... so do they have to install odbc driver??

I am making one small application which can store data to my online mysql server. But with c++ win32 how can I do it?

Hi,

a couple of days I posted something about how to handle SQL databases within C/C++ using ODBC.

You may look here.

If there are any questions you can ask me.

-- tesu

On client side you have alreay running a c++ system (VS2008, codeblocks...). Now you need to install Connector/ODBC on your computer. the odbc32.dll is aleady installed with VS2008. Then you should create a datasource for the simplest way to connect to sql database via odbc within c++ program is to using a xp/vista/win7 datasource.

Well, I wrote the cited function SlcProductTable for the guy who was asking for it and i called it from a larger c++ program already using databases to produce the output. I can also write a small main() showing you how to connect to database if you can't proceed.

-- tesu

thank you very much...so there is only one library has to be included in my c++ program...no need to install on client side..am i right??

Odbc requires that a data source (DSN) be created by means of your operating system. There you have to specify the driver for your specific database. Therfore this driver, delivered by mysql, must be installed priorly on your computer.

On my side we do developing c/c++ aps on and for linux and windows. That is the reason why we use pure odbc.

On windows only I would also prefer Mysql connector/c++ as Ancient Dragon already suggested. Indeed, mysql put the odbc interface and some more stuff into nice c++ class whereby it's really easier to do programming as against pure odbc.

Here you will find detail information on connector/c++. There are also complete examples you can just cut and past them into your c++ ide.

Because connector/c++ also works on odbc the Microsoft odbc manager is required. And that odbc manager always requires that the specific driver of your mysql database be installed. So I am afraid installing an odbc driver on every client side is also necessary, correct me if i am wrong.

-- tesu

commented: nicely put :) +28
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.