Sign in to follow this  

MySQL & C++

This topic is 4376 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

Hello, I am working on a project where I would like an easy way to integrate between a web site & a game. This is to simply pull highscores, and figure out whos logged in online (amoung a few other things). I decided one of the best ways to do this would be to utilize a MySQL database, and interact with it via both the application and the site. When I developed PokerVitals (pokervitals.com) for PTI, I used PHP glue code and curl, providing a simple REST based way of logging a user in to a subscription service, but I think there is defintly a better way here. The Problem I am not really sure where to start as far as accessing a mySQL server via an external application (using C++ here). I have thought for a while that a convinient way would be to use CURL and some scripted glue code in PHP, but I would prefer something cleaner. Im pretty sure there is already some code out there that does this, so its probably best not to undertake a large "recreate the wheel" project. So if anyone has any sudgestions or recommendations, drop me a hand! Thanks Richard P. Cesar

Share this post


Link to post
Share on other sites
IIRC, the MySQL C library is under the GPL license, which means, if you are putting the code on the actual client, then it is no good for commercial use.

There is also MySQL++ - however this is just a wrapper of the MySQL C library, and therefore probably suffers the same license restrictions.

If you have some sort of central server app running which communicates with the database, then you're fine, since you are not redistrbuting it.

It's probably a good idea to not put DB code onto an untrusted client anyway - you are giving away your connection string and therefore the username/password/IP/etc... Which just opens you up to attacks. Hell, they could just play with the memory on your app and not even bother connecting to it themselves, and just cause havoc via your app...

Here's one idea - consider setting up a web service which your client calls to set high scores and stuff - then you won't have to put any actual DB calls on the client, or even have to create an always-running server app. I don't know much about using web services in C++ thought - it might not even be worth the hassle, but it seems to me like your best bet w/o having a stand alone trusted server app.

Share this post


Link to post
Share on other sites
Actualy, as I mentioned thats what I was doing with a previous project. Created a REST based PHP web service to interact with the database. So yes, it can be done.

It is on a seperate server though, thankfully, the main thing im worrying about is the same thing as many... the new GPL rule thats supposidly in the works, which would ban it from commercial use on a server aswell. (the new GPL license)

Share this post


Link to post
Share on other sites
damn, that was fast... i had edited my post [grin].

i had no idea there was any new rules in the works...... i'd be surprised to hear something like that... it would really cost ALOT of people alot of money........ i really hope nothing like that comes up... good luck with whatever you do..

Share this post


Link to post
Share on other sites
taken from wikipedias referance to Stallman's April 7, 2005 talk in philadelphia

http://en.wikipedia.org/wiki/GPL#GPLv3

"Overall it's going to be the same, but there's just various areas where we're looking at changes in details. And, one of them is that we might put in some kind of patent retaliation clause, but it's hard to see what's a good one to do. We'll put in something to deal with this case of public use on a server the public connects to. We may put in something designed to prohibit putting the software into something that won't let the user, that refuses to run a modified version if the user installs one."

The key phrase here is:

"We'll put in something to deal with this case of public use on a server the public connects to."

What the FSF is refering to is requiring software used in publicly connected servers to be availiable opensource. Meaning if you write something (using GPL code), and host it on your server, its still under GPL (ie: requires you to make the source availiable). You have to completely prevent the public from touching the software, even remotely.

Yes, its going to suck.

OSS has its good and its bad. Stallman is, in many ways, a communist. (ok guys, bash me for it). The OSS movement was great in some areas, but its going to hurt us indies like it or not, this being one of them.

That being said, I see more and more people moving to the Mozilla, zLib, and BSD licenses, so all you can do is pray.

[Edited by - PaulCesar on December 17, 2005 5:46:41 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by PaulCesar
"We'll put in something to deal with this case of public use on a server the public connects to."

What the FSF is refering to is requiring software used in publicly connected servers to be availiable opensource. Meaning if you write something, and host it on your server, its still under GPL (ie: requires you to make the source availiable).


Actually, from this I'm reading that the server software should be open source. So, that if you modify your copy of Apache and run it on a public server, you must supply your modified Apache-code to the public. It does NOT mean that anything you host on that server, must be public too.

I'm no legal buff, not even a native English speaker, but that's just my two cents.

Share this post


Link to post
Share on other sites
Which may actualy be a good thing in some ways I suppose, but very bad for the OSS movement. Many industries have depended on it for the past 6-8 years, to revert back to how it was before is going to seriously mess many businesses up (providing the licenses do not enter a more liberal license scheme)

I will say though, that stallman is going to kill the GPL's usablility in the commercial sector completely.

Share this post


Link to post
Share on other sites
Dabono, thats not what I was refering to, you are correct.

But this is where it will hurt. Everyone that developes say.. a game based server (such as an MMORPG, MUD, etc) that uses open source code, will have to make the source code to that publicly availiable.

This causes many.. and i mean MANY problems:

1) With people having access to the server code, they will be able to find vulnerabilities and take advantage of them.

2) Competition will be able to legaly copy your codebase

3) Fans will be able to make servers, removing any real profit margin from running a subscription based service.

EDIT: This will completely demolish the profit margin for creating subscription based software that utilizes any GPL code , as well as some companies that make there money based on services which rely on a server using an GPL based codepath for the basis of the application.

Thankfully, banking institutions have a thing against using OpenSource software, or we could really be in trouble. But the same can not be said about the online gaming industry.

Share this post


Link to post
Share on other sites
Quote:
Original post by PaulCesar
But this is where it will hurt. Everyone that developes say.. a game based server (such as an MMORPG, MUD, etc) that uses open source code, will have to make the source code to that publicly availiable.


Only if they are using versions of this kit which are licenced under the new GPL. Code licenced under the old one will continue to be so forever.

Quote:

This causes many.. and i mean MANY problems:

1) With people having access to the server code, they will be able to find vulnerabilities and take advantage of them.


Well, you should't have any :)

Quote:

2) Competition will be able to legaly copy your codebase


Right, but the GPL will still apply to them. Plus also, your game data, tools, util programs not covered by the GPL are still entirely private and covered by normal copyright rules.

Quote:

3) Fans will be able to make servers, removing any real profit margin from running a subscription based service.


Still not a problem, as they will have to create 100% of their own original content, as your game content will not be covered by GPL.

Quote:

EDIT: This will completely demolish the profit margin for creating subscription based software that utilizes any GPL code , as well as some companies that make there money based on services which rely on a server using an GPL based codepath for the basis of the application.


Not necessarily. I'd argue that the real value is being created by

- The act of running the servers themselves
- The game content

Quote:

Thankfully, banking institutions have a thing against using OpenSource software, or we could really be in trouble.


In what way would having your bank release the source code to their online banking application cause trouble?

Quote:

But the same can not be said about the online gaming industry.


MySQL is not the only open source database.

The one which immediately springs to mind is SQLite, which is licenced under a much less restrictive licence than GPL.

It certainly doesn't prevent you using it in this manner.

Finally, the clincher:

Commercial licences ARE available for MySQL

Mark

Share this post


Link to post
Share on other sites
Quote:
Original post by PaulCesar
It is on a seperate server though, thankfully, the main thing im worrying about is the same thing as many... the new GPL rule thats supposidly in the works, which would ban it from commercial use on a server aswell. (the new GPL license)


AFAIK, almost all current GPL software is licenced under something like the following:
Quote:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

Which allows you to choose which version of the GPL to apply. Legaly, I don't think they can change from an optional version to a fixed version (the new one) in existing code. Although they can release further modifications under the new license.

Share this post


Link to post
Share on other sites
While this is an exciting topic (especially given that making money from a server infrastructure was shown as an example of a GPL-compatible business model in the beginning), it belongs in the Business of Game Development forum; not the networking & multiplayer forum. Please re-open the thread there (I'll close it if we get more discussions right here).

For the original poster's question, I have some sample code which shows how to issue a HTTP GET query to some server, and get the data back, in simple C++ code. That might help.

You should worry about forgeries, though -- someone else might want to connect to your server and issue the same type of queries, so think of what to do with authentication.

Share this post


Link to post
Share on other sites

This topic is 4376 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this