C++ How to

Started by
5 comments, last by monsterenergy 16 years, 8 months ago
How do you make websites with C++? How do you access sql databases with C++? Im not sure if this is possible can some one fill in the blanks!
Advertisement
Quote:How do you make websites with C++?


By writing CGI modules for a server that can handle such requests.

Quote:How do you access sql databases with C++?


By using C++ API provided by your database vendor.
Quote:Original post by monsterenergy
How do you make websites with C++?


Using C++ to write websites is like using swahili to discuss the intricacies of japanese grammar—you can do it (mostly receive and reply to HTTP requests, and/or CGI), but you won't get very far without insane amounts of work, and there are much better tools for the job anyway (C#, JSP, PHP).

Besides, unless you use CGI, you'd need your own server, because very few hosts allow execution of arbitrary executables on their non-dedicated servers (they usually provide either IIS or Apache).

So, unless you have a very specific need (which, if you have to ask this question, probably isn't the case), you don't make websites with C++.

Quote:How do you access sql databases with C++?


Depends on the database. Most databases provide an API to interact with them, and there are some portable APIs available which you may find through google.
A 'website' is simply a set of data returned via the HTTP protocol. Thus, any application which listens for incoming HTTP requests and responds appropriately (ie, a webserver or a module for one) can be used to create a website. I don't recommend attempting to write your own webserver, except for the sake of doing it.

There's quite a few SQL interfaces available, but the actual details vary between both what kind of SQL backend you're accessing, and what library you choose to interface with it. I'm not too familiar with the low-level stuff, but I'd assume the rawest way to do it is probably to open a loopback socket and communicate with it that way. You don't want to do that.

One library/database I've heard a lot of good things about is SQLite, which is essentially a self-contained SQL database with a C API. If you've already decided to use a different database backend, you'll have to find an appropriate API to interface with it.

Wow, too slow.
Quote:Original post by monsterenergy
How do you make websites with C++?


Very bad choice...
In fact the server-side active content is actually parsed by server applications running on the host computer. The most widely used are APACHE and Microsoft IIS.
If you want to develop active web content then it is really much wiser to choose between one of those technologies ( that is ASP.NET that includes VB.NET, C#.NET and J# to run on an microsoft IIS server, or PHP for APACHE, or some other language like JSP, Perl, etc.)
If you're familiar with C++ language and syntax, then C# (ASP.NET) is probably a good choice for you.

Quote:How do you access sql databases with C++?

Use API.
Again, C++ is really not the best language to use if you need to write database programs (like accounting applications) that would need sql access.
C# and VB are again more appropriate, but if you insist on using C++ then it is possible. Just use search engine.

[Edited by - memento_mori on August 14, 2007 2:38:36 PM]
Doing this with C++ probably makes your pages crawl with even moderate loads (no good caching or balancing). Using some Java server (JBoss, Liferay, GlassFish) technology in combination with some well defined framework like Tapestry, Spring, Java Server Faces, Hibernate etc. etc. is the way to go. In .NET world you get easier with the choice since there is ASP.NET (and ADO.NET/LINQ for database access) and perhaps Silverlight. But you need a server with at least .NET 2.0 framework in case you are about to go with Microsoft (you need a Windows Server 2003/2008 or you could try Apache with Mono mod).

This was mostly like enumerating some key technologies, but it should help you to figure out some more.
---Sudet ulvovat - karavaani kulkee
Thanks everyone for your help, I have took in all the information you guys have gave to me and I found that PHP looks almost the Same as C++. So i will use php with mysql for what I want to do thanks so very much you have shead some light on this misteroy of designing a database for my site thanks again

This topic is closed to new replies.

Advertisement