what is the difference between attacking your database directly or through the script that connects to it, the end result is the same.
A mount Everest of a difference. While a database is secured by a simple logon?
A web site is battle hardened against such security attacks. Prevention of cross site scriptong will exist, and even often any script modified on the page will also fail. (asp.net does this for example automatic).
and better yet?
You probably need to get a logon to to the web site FIRST.
Next up, while you might attack the web site with a script, you NOT going to get direct use of the database.
And if you direct connect to the database, then you can execute things like change user security, delete tables, or do whatever. A simple hacking of the web site in most cases will NOT let you create, nor run 100% server side (code behind on the web site). In fact, with asp.net the code behind in that site is compiled c# or vb.net (there is NOT even server side code available that you can modify!!!).
Also, database logons don't have robust security in place. So, things like how many password attempts can you do?
A simple logon to a database is not even close to the security that a web site will have.
And with a web site, you NEVER actually hit the web site database directly, do you? So, you be hitting a web method of the site, and IT WILL go connect to the database, get the data based on some web method that you CANNOT change nor modify!
So, having a whole web site between you and the database is a significant deal. This is why then in most cases you build and add some web methods, and your android phone then hits and consumes those web methods. Those web methods thus have VERY good web based security, and does not use nor rely on the database security system. So, you have a huge list of options, such as two factor authentication methods. And those logon systems also have 10+ years of battling those bots and systems that attempt to breach web based security. So, they been in the war, and at the war for many years.
In a nutshell?
The database security system is not appropriate for being exposed to the web. So, that's WHY all these web based systems are built around you adding some web methods that are web based, and return data. But, the code and systems that returns the data is NEVER seen, nor touched, nor even able to be changed by you.
So, even if someone gets a valid working logon to the web site, they are STILL in most cases limited to the web methods you created, and they can't change such web methods and code EVEN if they thwart or gain a valid logon. So even if they crack the logon to the web site, they STILL can't send raw sql commands to the database. And that logon will not let them modify or change the sql. If you direct connect, then the client side gets to make, build and send the raw sql commands. And better yet, they might get a logon to the site (like all customers), but now they going to have to hack away and try gain use of the database. For example, you are NOW logged on to this site, right? But, this message no doubt is stored in a database. You can't now hack away, and I doubt VERY much you can or will figure out how to hit the database system that drives this site, and yet you logged on just like I am! So, in most cases, gaining a logon to the web site gives you very little - and in fact the web site is designed to allow users to logon, but that still don't get or let you hit the database system at all.
With a logon directly to the database? I don't have ANY web based authentication or security systems in place, but only a simple password. And with a direct connection to that database, in most cases I can quite much do anything I want to that database, including deleting tables, or grabbing all rows of data, not just the rows of data that say belong to me, based on that fancy pants authentication that the web server has in place.
In most applications, the database does NOT control who gets to see their own data, but is in fact based on the user logon to the web site, which THEN in turn hits the database and pulls data based on your web based logon and authentication. (so you only still ever see and get your own customer information - not the whole database).
I willing to bet that even amazon on-line works this way. The database is not secured by each logon user. But the web site, and YOUR logon is what most certainly restricts the data you see, can get, and is returned from that database to see things such as your orders, and whatever.
So, security of a database is too lame, too limited, and in most cases a direct connection to a database gets you in, and from that point on, little if any levels of security, or EVEN the ability to restrict what rows of data you pull and see does not exist. You be able to execute a query against that database, and it not going to out of the blue restrict rows that JUST belong to you, but you have full use of the tables and data - all data, not just what your supposed to get and see based on your web logon.
In effect, such a setup has little security, but worse has next to no means to restrict a query to ONLY get data based on your logon. And above is the short version of how significant the two approaches to security are. As noted, due to this, few systems or web sites allow one to by-pass the whole web site and direct connect to the database that drives that site.
So, a good question. And as above shows - there is a significant difference here between a direct connection to a database vs that of connection or logging on to a web site. And even most web method calls are going to use, include and rely on the web based security systems in place. And even then, those web methods go get the data - no you, nor a direct query sent from your phone. With a direct connection, then your android is sending the sql commands directly to the database. With a web method, the code behind go gets the data, and returns it to the client side - you never really sending any direct sql commands to the database, but asking the web site to please go get some customers based on a get customers web method. You only get to see the results, not the actual code and SQL used for web method.
so with a direct connect, you don't really get much of any means to restrict data to the one user - you have in most cases full use of the database, and all tables and all rows of data.
Opening up a database to direct external wild internet connections? Simply a non starter choice in my view.
Regards,
Albert D. Kallal
Edmonton, Alberta Canada