954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C++ and MySQL connection

Hi,

I was wondering if it is possible to connect a C++ program to a MySQL database on Linux Fedroa Core 5 os. It would be great if I could create a program in C++ that allows me to create a completely new database in MySQL, edit, modify, delete and update records and tables within it. But can't find much help on the net. Can any one please lend me some of the necessary knowledge. Thanks.

tech291083
Junior Poster
181 posts since Oct 2006
Reputation Points: 15
Solved Threads: 0
 

Something like this ?

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 
Something like this ?



Hi,

Thanks a lot for the reply, it seems that there is a need to download the C++ API for MySQL in order to make a connection between the two, but what actaully I am after is a simple piece of code that demonstrates the connection between C++ and MySQL. I would also like to have the basic guidelines on how to install the C++ API from the url you have kindly given to me. I would also go on trying to do it on my own, but there is a strong possibility of a failure underlying the fact that I am quite new to Linux and C++ both. More help would be sincerely appreciated. Cheers.

tech291083
Junior Poster
181 posts since Oct 2006
Reputation Points: 15
Solved Threads: 0
 
Hi, I was wondering if it is possible to connect a C++ program to a MySQL database on Linux Fedroa Core 5 os. It would be great if I could create a program in C++ that allows me to create a completely new database in MySQL, edit, modify, delete and update records and tables within it. But can't find much help on the net. Can any one please lend me some of the necessary knowledge. Thanks.



hi,
I have done a similar application in windows platform.
there i have used an ODBC Driver to connect,even u can connect Mysql server directly.
u create databases,execute queries also.
bye,
sree

sree_asrl
Newbie Poster
5 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 
hi, I have done a similar application in windows platform. there i have used an ODBC Driver to connect,even u can connect Mysql server directly. u create databases,execute queries also. bye, sree



Thanks for the help, but I am using Fedora core 5 32+ bit as my os and I would like to ask again weather I need to download the C++ API to make it all work from the following url: http://tangentsoft.net/mysql++/

But if I do not install the above API and try to connect to a MySQL database with a C++ program is it going to work? I am a bit confused and lost here, need some more guidance. Thanks,

tech291083
Junior Poster
181 posts since Oct 2006
Reputation Points: 15
Solved Threads: 0
 

I guess you will have to put in a bit more effort and try it on your own. Download the documentation related to the API and do some experimentation....

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 
I guess you will have to put in a bit more effort and try it on your own. Download the documentation related to the API and do some experimentation....



Hi,

Thanks, I have downloaded the source rpm to my desktop.

Here they are on the page( http://tangentsoft.net/mysql++/ ) under a big heading called "Latest Stable Version" and they are the second link saying

" mysql++-2.2.0-1.src.rpm (2.6 MB, 2007.01.23) — Source RPM, for those that need to build their own binary RPMs. To do this, run this command as root:

# rpmbuild --rebuild /wherever/it/is/mysql++-2.2.0-1.src.rpm"

and then tried to build it with the following command in a terminal:

# rpmbuild --rebuild /wherever/it/is/mysql++-2.2.0-1.src.rpm

but some error messages showed up. Here they are:

warning: user tangent does not exist - using root
warning: group tangent does not exist - using root
error: Legacy syntax is unsupported: copyright
error: line 5: Unknown tag: Copyright: LGPL


This is what the terminal windows looks like:


[root@localhost Desktop]# rpmbuild --rebuild mysql++-2.2.0-1.src.rpm
Installing mysql++-2.2.0-1.src.rpm
warning: user tangent does not exist - using root
warning: group tangent does not exist - using root
error: Legacy syntax is unsupported: copyright
error: line 5: Unknown tag: Copyright: LGPL
[root@localhost Desktop]#

Can you help me with these errors please. Can't figure out any thing here at all.

tech291083
Junior Poster
181 posts since Oct 2006
Reputation Points: 15
Solved Threads: 0
 

Why do you want to build from source code when pre built binaries are readily available on the site?

I haven't personally used this API but you can try downloading the binary files under "Linux Binary RPM's" and trying them out. (they even have some examples).

If that doesn't work, you can try out this API.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 
Why do you want to build from source code when pre built binaries are readily available on the site? I haven't personally used this API but you can try downloading the binary files under "Linux Binary RPM's" and trying them out. (they even have some examples). If that doesn't work, you can try out this API.



I think you are right I have made a mistake here. I will try the 4 binaries under "Linux Binary RPM's" and let you know as what it happening. Thanks your help is crucial.

tech291083
Junior Poster
181 posts since Oct 2006
Reputation Points: 15
Solved Threads: 0
 

libmyodbc

(a simple odbc for linux and mysql)

would be great if we had a wine odbc, I'd love to get some of my odbc reliant dbase apps runnning via wine.

mikejonesey
Newbie Poster
2 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You