SQL Database

Started by Dualnames, Wed 09/04/2014 14:34:21

Previous topic - Next topic

Dualnames

Yeah, well, I know this isn't the right place in the entire internet, but I am having troubles looking up in google, so perhaps i can be pointed to the righter direction.
I've always hated bothering with Sql databases, so I am quite unprofficient with them.

Now, I've created a dataset hosted currently locally (thus a local database) which contains various data and tables, which I access perfectly via a C# windows application, which handles the local database the way I intended. Now, what I want is to transport said database to the web, and hand out the application to people, and they all could use the win app to connect to the same database, hosted in a server.

How do I do that?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Snarky

Oh, I'm working on much the same thing at the moment. :)

The conventional way of doing this would be to set up an app/web server to sit between the database and the client app. The client would make requests/posts via http to the web server, which would make queries and updates to the database on behalf of the client and return the results. I don't think it's a smart idea to let the app access the db directly, because that leaves you open to all kinds of hacking. (By inspecting the traffic, a hacker could figure out how to connect to your db, and then run arbitrary queries on it. It would be like SQL injection, only even easier.)

Personally I'm most familiar with using java for the app server, but if the API is simple, it might be quicker and easier to write it in PHP (e.g. on top of the Apache HTTP server). I'm sure .NET also offers an alternative (ASP.NET, maybe?), but I'm not familiar with that.

Then you need to host it somewhere public, so people can access it over the Internet. If your ISP gives you a fixed IP address, and you have an always-on-computer you can use, you could host it from home. Otherwise just rent server space from a hosting company. Since access is through your custom app, you might not even need to register a domain for it, just direct the app to the IP address. (Of course, that becomes a problem if the IP should ever change.)

Dualnames

Would perhaps changing the connection string do the trick? I don't care much about security now, I just want to make the proof of concept, I am not going to be developing this in the process. So perhaps uploading the localdatabase file ton an ftp or something and then perhaps changing the connection string, will do the trick?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Snarky

#3
Mmmmmaybe?

The thing to keep in mind is that a database is an application, not just a passive storage. .NET may be hiding a lot of complexity from you there. You can't simply tell a file on an FTP server to "SELECT * FROM mydatabasetable WHERE yougetthepoint='true';" If you have the db data file on an ftp, I think what will have to happen (if it works at all) is that the client app (which will be running the database internally) will download the whole file upon opening, and then perform all activities on the local copy, until at some point re-uploading the updated version.

I don't have to tell you that that will cause all sorts of concurrency issues (if anyone else has made any changes to the db since you downloaded the file, they will be lost). It's kind of pointless: you might just as well just distribute the version you have now and have people just run it with a local db.

What you can do is run just the db on a server, and set it to accept remote connections. Then you can change the client connection string to connect there. That will, as mentioned before, leave you open to anyone sending a "DROP TABLE [yourdatabasetable];" command, and you still have to make sure that you don't get concurrency issues between SQL queries/updates, but unless I'm mistaken it's the simplest way to do what you want.

SMF spam blocked by CleanTalk