LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

Rep: Reputation: 15
MySQL And C++


Hey,
Anyone managed to run mysql commands with c++? There is a utility on mysql.org 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 = query.store();

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

query << "select * from stock";

Result res = query.store();


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

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

Row row;
cout.setf(ios::left);
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;
}
 
  


Reply


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 03:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-08-2008 12:48 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM


All times are GMT -5. The time now is 06:51 PM.

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