Is there any way to connect/read/write to an MSAccess Database that is located on a web server?

Posted on 2003-03-10
Medium Priority
Last Modified: 2010-04-01
I am trying to develop a small text MMRPG and am trying to connect to an access database from within c++. I would like the user to download an exe file and have that file be able to connect to the database located on my website. (Like counter-strike, or any other game that checks the cd key against a database - this is not the purpose of my connection, but I would like for the program to be able to connect in a similar fashion.) If this is not possible, is there any way for me to design an asp page that can send information from a querystring to a database and access that asp file from the cpp source?
Thanks in Advance, this site is always great.
Adam Jarret
Question by:aj72886
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 12

Expert Comment

ID: 8104051
Anything a browser such as internet explorer can do, so can you do also.

Typically you will then make a HTTP connection to your database machine and will make HTTP requests to it. That machine will then have a web site that receives those requests and handle them by doing the actual DB lookup. The program on the client side will never see the DB. It will only send various queries and it is the web site that does the DB lookup based on that query string.

You can write a text MMRPG based on this framework but it would be much easier for you to just do most of it in the web server anyway. This way people only needed a web browser to play it. If you need to do anything more advanced or anything, write it in small java applets that runs on the client side.

Don't depend on high speed for your game using such technology. If you need speed you need to rather make your MMRPG in a traditional fashion running it as a dedicated MMRPG server which receives requests and handles them. You can still use a DB to access the data but you would be better off with a smart caching mechanism - if you were to access the DB each time someone came into a room it would probably be very slow, but using a cached datbase so that you first checked if you already had the database information in memory already and only accessed the DB when you found it wasn't in memory then you would have something that would work.

The HTTP protocol wasn't really designed with speed in mind, it is used for simple query/response - well they can get quite complicated but they're still simple in structure and any query can take a long time before you get a response.

The good thing with HTTP though is that it is always available, most people have some form of web browser these days and if the game can be played straight from the browser it might get very popular.

Another good thing with HTTP is that it is fairly easy to do graphics with it, sending images etc is just as easy as sending text. It is easy to change font and colors etc since all the output is essentially plain text having HTML tags.

It is also very international if you output UTF-8 or something.


Author Comment

ID: 8107330
I was afraid connecting to the database from pages on the server would be slow. This is acceptable, but I was asking more specifically how use an asp page (as in send information to it and use it to update a database) from within C++. I need to use C++ for a language as one of the guidelines for the project. But I am also interested in how to use the CGI-BIN (or something) folder to have a separate .exe (or web-equivalent) to be running all the time generating game data. I have had NO experience with this (CGI) so if you could recommend a good article or website I would be much obliged.
Thank You

Adam Jarret
LVL 12

Accepted Solution

Salte earned 500 total points
ID: 8109480
Well, the CGI bin is simple enough. It very much depends on what server you run but I belive all web servers today are such that a CGI program is run in such a way that stdin is the data from the client (the request data) and stdout is sent to the client as the response.

Normaly stdin is empty - it is only used for sending large amounts of data using the <form> tag.

One very important part of the request is the request URL. This URL is the line that the client sent to the server and is often something like:


The query string - the stuff after the question mark - is stored in an environment variable for the CGI script and contain arguments.

Since these arguments cannot contain spaces or other special characters they are quoted, you have probably seen stuff like %20 etc. So before you can use those arguments you usually have to unquote them.

However, there are libraries that does all that for you and provide you with a simple query to get the value of a variable named "bar" and you get the response "3" as a text string and you can then do whatever you like, for example convert that value to an integer and use it as you like.

If the web page had a <form> </form> tag containing a button then if the user presses that button you also can get lots of data. For example web forms that have big edit boxes to type large amounts of data often send the data this way. In this case the text is sent not in the header in the URL but as the body of the text message. The HTTP protocol uses MIME - a format originally designed for sending E-mail - and so has a header and a body containing the text of the message. When the user send a request from a form he will then typically send a POST with a URL and a header and the text written in the form as a body of that message to the server. The CGI script get that text body in stdin.

This also implies a co-operation between the CGI code and the HTML that generated the request. Usually they are the same as it is the very cgi script that generates the HTML code that the user can see. The generated HTML will therefore contain <a> tags to self with specified URLs to do what you want and perhaps some <form> tags with POST methords as well.

The <a> tags generate GET requests while <form> tags can generate both GET requests and more often POST requests.

Info about all this can be found by searching for info about the HTTP protocol and the HTML language. For details about <form> and other tags check out www.w3c.org. You don't want to go to www.w3c.com, that's a different site. The www.w3c.org is the site that describes HTML, XML, and all other web related languages.

CGI itself is probably best described in a book. O'Reilly has a very good book on the subject, I believe there are others also.


Author Comment

ID: 8121662
Thanks a ton
Hope u get ur points!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question