Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-04-2003, 10:42 PM   #1
Registered: Oct 2003
Location: Blacksburg, VA
Distribution: Fedora Core 2 (kde)
Posts: 144

Rep: Reputation: 15
MySQL And C++

Anyone managed to run mysql commands with c++? There is a utility on call Connector/C++ which is supposed solve that problem but when I installed that rpm and tried a test program it gave me 5 pages of errors on the sqlplus header files....
Now I am running RH 8.0, mysql server 4.0.12-0, gcc-3.2-7 and this is the test program I was trying to run and it chokes on that 3rd include line... can anyone help?? Thanks a lot

#include <iostream>
#include <iomanip>
#include "/usr/include/sqlplus.hh" *************************************************************

int main() {
Connection con("movies, dimitar, "123"");

Query query = con.query();
query << select * from my_movies;
Result res =;

cout << "Query: " << query.preview() << endl;

query << "select * from stock";

Result res =;

cout << "Query: " << query.preview() << endl;

cout << "Records Found: " << res.size() << endl << endl;

Row row;
cout << setw(17) << "Item"
<< setw(4) << "Num"
<< setw(7) << "Weight"
<< setw(7) << "Price"
<< "Date" << endl
<< endl;

Result::iterator i;
// The Result class has a read-only Random Access Iterator
for (i = res.begin(); i != res.end(); i++) {
row = *i;
cout << setw(17) << row[0]
<< setw(4) << row[1]
<< setw(7) << row["weight"]
// you can use either the index number or column name when
// retrieving the colume data as demonstrated above.
<< setw(7) << row[3]
<< row[4] << endl;
return 0;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-07-2008 11:48 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration