?
Solved

C++ CGI MySQL++

Posted on 2005-02-27
13
Medium Priority
?
434 Views
Last Modified: 2013-11-18
I need to connect to a MySQL database using a C++ CGI. I've tried using mysql++ but I keep getting errors during compile. The only time I got it to work was when I used the Visual Studio project file that was included, but I prefer to stay away from Visual Studio. Using a different compiler, I get errors stating that there is a syntax error on the line that calls Connection, even though there isn't. Or I get an error stating that Socket is used an object.

I need someone to provide me with sample code that actually compiles, and tell me exactly what libs/header files to include.

I am using Bloodshed Dev C++, but am able to switch if there is a better compiler out there.
0
Comment
Question by:mvp836
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
13 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13416167
In fact you don't need a c++ wrapper, you can just work with mysql library:
http://downloads.mysql.com/archives.php?p=mysql-3.23

Have a look to this previous question for a sample:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20634727.html
0
 
LVL 30

Expert Comment

by:Axter
ID: 13416232
>>The only time I got it to work was when I used the Visual Studio project file that was included, but I prefer to stay away from Visual
>>Studio.

If you're already have VC++, then I recommend sticking with it.

Why do you want to stay away from Viusal Studio?

Please post the exact compile errors you're getting, and the file.
0
 

Author Comment

by:mvp836
ID: 13416309
I follwed the second link posted by jaime, nd when i compile that segment of code, two of the errors I get are:
154 mysql_com.h 'SOCKET' is used as a type, but is  not defined as a type.
298 mysql_com.h syntax error before `,' token

mysql_com.h came with the mysql-noinstall-4.1.10-win32 package.

Axter, I would prefer to sty away from Visual Studio becuse it does not 100% comply with the C++ standards.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 30

Expert Comment

by:Axter
ID: 13416343
>>Axter, I would prefer to sty away from Visual Studio becuse it does not 100% comply with the C++ standards.

There is no compiler that is a 100% compliant with the C++ standard.

VC++ 6.0 does have poor compliance with the standard, if you compare it to the GNU compiler (3.x)
However, VC++ 7.1 is more compliant to the C++ standard, then the GNU compiler (3.x)

So if you're really concern about a C++ compliant compiler, then I would move to VC++ 7.1, and not use the 3.x GNU compiler.
0
 

Author Comment

by:mvp836
ID: 13416487
Axter, even if you do believe that Visual Studio is more compliant than the GNU compiler, I would still like to stay away from a $109 product that only includes VC++ when I have a choice of several $0 products.

0
 
LVL 30

Expert Comment

by:Axter
ID: 13416942
>>Axter, even if you do believe that Visual Studio is more compliant than the GNU compiler,

This is not what I believe.  It's the result of a third party study on multiple compilers, in which they rated them.  (FYI: VC++ 7.1 was not the highest rate compiler, but it was higher then the GNU compiler)

>>I would still like to stay away from a $109 product that only includes VC++ when I have a choice of several $0 products.

If price is the motivating factor, then yes, the GNU compiler would be the right choice.

But the GNU compiler is not a good choice if compliance to the standard is the only factor you're using, and that's the only reason you gave in your previous post.
0
 

Author Comment

by:mvp836
ID: 13417171
I also stated that I had a problem with connecting to MySQL, not that I wanted to find a compiler with compliance. This is C++ Programing, right? Not C++ Software?
0
 
LVL 30

Accepted Solution

by:
Axter earned 252 total points
ID: 13418481
>>also stated that I had a problem with connecting to MySQL, not that I wanted to find a compiler with compliance.
>>This is C++ Programing, right? Not C++ Software?

C++ Software is part of C++ programming. (Right???)

This topic area deals with everything and anything dealing with C++ programming.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13420123
About the SOCKET problem, this is cause for the lack of a sockets library.
If you are building a Windows App, try to use:

#include <winsock2.h>    
#include <mysql.h>

0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 248 total points
ID: 13420183
Since I have answered about your SOCKET problem, I want to comment this:
>>I would still like to stay away from a $109 product that only includes VC++ when I have a choice of several $0 products.
The is not a cero-cost product, you have to add the time you have to spend in the learning curve, and the time you spend in working with it (this is called the TCO - Total Cost of Ownership).
That's why cheapest Linux version has largely more TCO than Windows.
So, $109 Visual C++ is a cheap product, with dozens of libraries (MFC,ATL,COM,DCOM,.net,etc...) and programmers tools, and hundreds of supporting web pages (I like codeproject.com and codeguru.com).
Then, if you really preciate your time, take a while to think about this.
Good luck,
Jaime.
 
0

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question