If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > mysql in collaboration with c++

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-04, 12:08
pssheba pssheba is offline
Registered User
 
Join Date: Oct 2004
Location: israel
Posts: 7
mysql in collaboration with c++

I want to insert values to a mysql table from inside a c++ program such as:
Code:
int main()

   // the following is a mysql command
   use MyDb;

   for(int i=0; i++; i<10)

      // The following is a mysql command
      INSERT INTO MyTable(Counter)
     VALUES(i);

   return(0);
can anyone explain me how i can contact my local mysql server (in 'localhost')
and how do i write the above mysql lines in a c++ syntax ?
Tanks !
Reply With Quote
  #2 (permalink)  
Old 12-06-04, 04:30
Aerodyne Aerodyne is offline
Registered User
 
Join Date: Jun 2004
Posts: 9
Hi,

Haven't used C++ to conect to a MySQL db yet ...but you could probably try these links for more info:

C connection API: http://dev.mysql.com/doc/mysql/en/my...l_connect.html

C++ info:
http://tangentsoft.net/mysql++/
Reply With Quote
  #3 (permalink)  
Old 12-08-04, 09:54
pssheba pssheba is offline
Registered User
 
Join Date: Oct 2004
Location: israel
Posts: 7
Thanks a lot !

an i use the c code and save myself downloading mysql++?
Reply With Quote
  #4 (permalink)  
Old 12-09-04, 03:42
drahul drahul is offline
Registered User
 
Join Date: Dec 2004
Posts: 3
You need to link your program against the mysql client libraries , which provides you a set of API for connecting and quering the database. The steps are really simple.

check out http://dev.mysql.com/doc/mysql/en/MySQL_APIs.html

they are C API's can be very well used in C++ code.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On