Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Completely Confused... C++ CGI & different OSs & Databases :S

Status
Not open for further replies.

TheFoxy

Programmer
Nov 22, 2002
48
GB
First off, sorry if this is in the wrong forum, but there is such a bewildering array of very specific forums on this site that this is the best one I could find to ask in.

Now, I am running a Windows system (98). I am planning to run a website on a server that is most likely to be Linux/UNIX (Is Linux a subset of UNIX btw? I've never known) but could also be a Windows server (2000, .NET, whichever).

On this site, I want to have database(s), which could be MySQL, MS Access, or others, or a combination, accessed and manipulated by C++ CGI scripts (as I want to learn C++ anyway, and Perl is far slower). Now, how would I go about writing C++ scripts that would not need to be changed for different server OSs and database types?

I've heard of ODBC, but theres no definitive site (not that I've found anyway), and the mass of different variations/definitions/toolsets/sites just confuses me more and more!

Can anybody help? It would be much appreciated.
 
>> that would not need to be changed for different server
>> OSs and database types?

Not possible. Different databases do not have common cross platform connection mechanism from C/C++

>> I want to learn C++ anyway

I would not recommend learning C/C++ by writing CGI applications that access databases. The web/database environment complicates the C/C++ learning curve by a factor of ?? I don’t know but it is big [lol]

For learning C++ use a tutorial or book targeted for beginners.

>> Is Linux a subset of UNIX btw?

subset? I don’t know what you mean by that. Linux is a version of Unix ported to the Intel platform. It might have been FreeBSD I think… maybe.


-pete
I just can't seem to get back my IntelliSense
 
*I would not recommend learning C/C++ by writing CGI applications that access databases. The web/database environment complicates the C/C++ learning curve by a factor of ?? I don’t know but it is big
For learning C++ use a tutorial or book targeted for beginners.

I've already got a book about it, its just that I never learn by writing simple, throwaway programs that are basically a waste of time to create. I mainly learned VB via a beginner's book, but I hardly ever wrote the tutorial programs: I did a bit of research and wrote some vaguely useful programs instead.

*>> Is Linux a subset of UNIX btw?
subset? I don’t know what you mean by that. Linux is a version of Unix ported to the Intel platform. It might have been FreeBSD I think… maybe.

Obviously you did know what I meant, since you answered my question :D

*>>  that would not need to be changed for different server
>> OSs and database types?
Not possible. Different databases do not have common cross platform connection mechanism from C/C++

Damn. Can you give me any more general info on this topic? How would I go about accessing each different database type on Linux/Windows in C++???

(Btw, can Access databases be put on a Linux/UNIX server and accessed?)
 
[blue]I mainly learned VB via a beginner's book, but I hardly ever wrote the tutorial programs: I did a bit of research and wrote some vaguely useful programs instead.
[/blue]
C/C++ is not VB... just a warning but proceed as you desire

[blue]How would I go about accessing each different database type on Linux/Windows in C++???[/blue]

From windows you have high level interfaces like OLEDB and ADO as long as your DB vendor provides the drivers. If they don’t then you would use the Vendors proprietary API (most provide a C interface).

From Linux you may be limited to the Vendors proprietary API since I am not aware of any standard database interface for the Unix platform in C/C++

[blue]can Access databases be put on a Linux/UNIX server and accessed?) [/blue]

No

-pete
I just can't seem to get back my IntelliSense
 
*C/C++ is not VB... just a warning but proceed as you desire

Yeah, I know C++ is going to be complex. One look at the chapter in my book about memory access, and pointers confirmed that and notched the complex factor up by 2 :p

Basically, I've reached irritating limitations in VB (file handling is rather basic in my experience), so I want to go a step further. Besides, getting to grips with some basic C++ now should help with my understanding of programming generally.

So, anyway, if I wanted to stick a database on a Linux server, what database would I use (are there any free ones that don't need complex installing on the server, and can just be transfered over as a few files? *looks hopeful* there always seem to be limits on the number of MySQL DBs you can have on your site :/ ).

In any case, is it better to have one central database for a site or seperate ones for different sets of virtually unrelated data? In Access I would just put in a load of seperate tables into the one database, but I don't know if it works differently on the web. (Does it slow down the scripts that access the db as one db handles all the requests, etc)

According to what you said, if the server was Windows, I would get the high level windows interface avec DB driver, or use the DB's own API, right? (I'm guessing for Access I could use MS's MDACs, correct?)

Sorry to plague you for info, but some clarity and extra knowledge on this subject would be useful! :)
 
>> Sorry to plague you for info

That's what we are here for. Your asking meaningful questions providing information about what knowledge you do have, what more could we ask for? TheFoxy... pictures maybe [lol]

>> if I wanted to stick a database on a Linux server

I have no knowledge of that. Try the Linux forum or the Unix C++ forum (please don’t cross post until someone suggests you do… um like this ;-) )

Linux Server: forum54
C++ Unix: forum208

>> I don't know if it works differently on the web

Well the web doesn’t have anything technical to do with it, rather the potential use model for your database application running on the web. In theory you could have a traditional client server application that had a use model of 800 million users with load rates of 50,000 requests per second and you would have the same problem to solve. So when architecting your application, including if you need to split databases across multiple servers, just consider your use model and requirements and design it appropriately.

>> I'm guessing for Access I could use MS's MDACs, correct?

Yes, also for SQL Server and Oracle and others I think. You need to research ADO or OLEDB when referring to the MDAC programming API's. In C++ i find ADO very simple to use and there are plenty of articles and samples etc. on MSDN

-pete
I just can't seem to get back my IntelliSense
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top