c++ and databases

C

cppaddict

Hi,

Please let me know if there is a better newsgroup to post this question on,
but here goes....

I want to learn the basics of having a C++ program interact with databases
such as MySQL or SQLServer.

In particular, I want to write a program which parses a large text file and
then siphons off the
various data into appropriate tables and columns in a db.

1. Can anyone give me any good references to get started (books or web
articles)?

2. Can anyone give me an overview of what's involved here, how difficult
this will
be to learn, etc? Right now I am a beginner C++ programmer and a fairly
experienced DB
designer.

3. Can anyone explain how such interactions are accomplished, just in very
general language.
Does this involve COM objects? How can C++ connect to and issue commands to
a DB?

Thanks for any info,
cpp
 
A

Artie Gold

cppaddict said:
Hi,

Please let me know if there is a better newsgroup to post this question on,
but here goes....

I want to learn the basics of having a C++ program interact with databases
such as MySQL or SQLServer.

In particular, I want to write a program which parses a large text file and
then siphons off the
various data into appropriate tables and columns in a db.

1. Can anyone give me any good references to get started (books or web
articles)?

2. Can anyone give me an overview of what's involved here, how difficult
this will
be to learn, etc? Right now I am a beginner C++ programmer and a fairly
experienced DB
designer.

3. Can anyone explain how such interactions are accomplished, just in very
general language.
Does this involve COM objects? How can C++ connect to and issue commands to
a DB?

You're in the wrong place -- C++ itself knows not of databases.

STFW!

[try: http://www.mysql.com/products/mysql++/index.html]

HTH,
--ag
 
D

David

cppaddict,

Hi,

Please let me know if there is a better newsgroup to post this question on,
but here goes....

I want to learn the basics of having a C++ program interact with databases
such as MySQL or SQLServer.

In particular, I want to write a program which parses a large text file and
then siphons off the
various data into appropriate tables and columns in a db.

1. Can anyone give me any good references to get started (books or web
articles)?

Look at the examples for a given database, such as MySQL. There are
examples and the engine is pretty easy to get installed. It will teach
you the basics. MS Access and MS SQL are progressively more industrial
strength but follow the same basic guidelines. If you use one of the
MS interfaces, such as ODBC, porting your code from one database to another
is very simple.

There are also several databases with full source. Some are like MySQL.
2. Can anyone give me an overview of what's involved here, how difficult
this will
be to learn, etc? Right now I am a beginner C++ programmer and a fairly
experienced DB
designer.

Given the examples from MySQL, you could probably adapt them to your
own needs pretty quickly. MS SQL offers many more interface types: DAO,
ADO, ODBC, XML, ...
3. Can anyone explain how such interactions are accomplished, just in very
general language.
Does this involve COM objects? How can C++ connect to and issue commands to
a DB?

Any form of IPC (Inter process communication) is useful. Many engines are

just TCP/IP servers. Any small example should get you started.
Thanks for any info,
cpp

David
 
D

Deming He

cppaddict said:
Hi,

Please let me know if there is a better newsgroup to post this question on,
but here goes....

I want to learn the basics of having a C++ program interact with databases
such as MySQL or SQLServer.

In particular, I want to write a program which parses a large text file and
then siphons off the
various data into appropriate tables and columns in a db.

1. Can anyone give me any good references to get started (books or web
articles)?

2. Can anyone give me an overview of what's involved here, how difficult
this will
be to learn, etc? Right now I am a beginner C++ programmer and a fairly
experienced DB
designer.

3. Can anyone explain how such interactions are accomplished, just in very
general language.
Does this involve COM objects? How can C++ connect to and issue commands to
a DB?

Thanks for any info,
cpp
For SQL server, better use ADO. Go to: microsoft.public.data.ado for more
info.

To issue command, you need to use an ADO connection object of pointer type,
_CommandPtr. MSDN has included tons of info about this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top