Archived

This topic is now archived and is closed to further replies.

Interacting with web-based databases from c++ apps

This topic is 5010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m currently building a web site which deals with registration, user verification & details etc. I wondered how easy it would be to do the same things to the same database from a c++ app running on my pc. There''d have to be a way of connecting to the net, then a way of interacting with a database (I''m using MSAccess now ie Jet but actually connecting as an OLE DB). If I was using .net I think I could use the same classes (syste.Data.OleDb....) as I do from ADO.NET online - is that correct? Unfortunately I have visual c++ 6.0 so will have to do this the hard way! could you give me some tips as to what this will involve and how I''d start to go about it? Thanks

Share this post


Link to post
Share on other sites
You can use the ADO COM objects, OLE DB, or use the ODBC libraries.
ADO is high-level (next generation OLE DB), ODBC is low-level.

ADO is buggy as hell, but it''s actually less buggy directly using the COM interfaces in C++ (VB6 has trouble without multiple implementations of the same connection point interface, which means it''s hard to make modulariz3e component with asyncronous operations).

ADO.Net is the next generation after ADO.

There''s a Database Template Library as well (which is portable becuse it''s based off ODBC).
The goal of this library is to make ODBC recordsets look just like an STL container

- Magmai Kai Holmlor

Not For Rent

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]
[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]

Share this post


Link to post
Share on other sites
Thanks, on first impressions OLE sounds good I think. Would you care to point me in the direction of a tutorial or two? It should be relatively simple bar the connection process - in ASP/ADO you just connect with a string, then perform a query with another string. Once you''ve got the recordset it''s simple to actually get the data out. Is the process similar from a c++ app viewpoint? On first thoughts, actually drawing the tables to display data in windows should be the hardest part!?

Share this post


Link to post
Share on other sites
Wow, I''ve actually got a set of tuts from msdn! In fact they have corresponding series for ADO, ODBC, OLEDB...

From what I''ve read ODBC seems the way I should go. It can be used from straight C/C++ wheras OLE and ADO require COM and the examples I find all use MFC - skills I want to get but one new thing at a time is best!

I''ve found some DSN-less connection strings and using ODBC it looks as simples as:
1)Get a few handles
2)Make a connection to the driver, specifying the database to be used.
3)Build and execute a SQL query
4)Interpret the results
5)Free the handles.

Is it this simple in reality? It looks from msdn like it would be SO easy in VS.net to do ODBC,OLE or whatever just by transposing the class-method names and the format of the connection string; makes me wish I had it now!

Share this post


Link to post
Share on other sites