Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Businesses Security IT

The History of SQL Injection, the Hack That Will Never Go Away (vice.com) 193

An anonymous reader writes with this history of SQL injection attacks. From the Motherboard article: "SQL injection (SQLi) is where hackers typically enter malicious commands into forms on a website to make it churn out juicy bits of data. It's been used to steal the personal details of World Health Organization employees, grab data from the Wall Street Journal, and hit the sites of US federal agencies. 'It's the most easy way to hack,' the pseudonymous hacker w0rm, who was responsible for the Wall Street Journal hack, told Motherboard. The attack took only a 'few hours.' But, for all its simplicity, as well as its effectiveness at siphoning the digital innards of corporations and governments alike, SQLi is relatively easy to defend against. So why, in 2015, is SQLi still leading to some of the biggest breaches around?"
This discussion has been archived. No new comments can be posted.

The History of SQL Injection, the Hack That Will Never Go Away

Comments Filter:
  • by Anonymous Coward

    HIV is easy to defend against. Relatively so, also, are things like malaria. Yet they still manage to kill millions. Why, in 2015? Also, is that more or less of a concern than SQL injection attacks?

  • by Anonymous Coward

    Each year brings a fresh crop of computer science graduates into the industry, barely any of them having a clue about attacks like this. Many of them will make these mistakes and learn about defending against them the hard way.

    Maybe a few schools teach about this now. Maybe a few companies will pair senior devs with new devs to transfer this knowledge on the job. Even so, there will be enough new programmers who don't know this, and enough companies who eschew senior talent as a cost-savings measure, tha

    • by Rei ( 128717 ) on Sunday November 22, 2015 @02:04PM (#50980983) Homepage

      Even older programmers do it - I discovered just last Friday that a senior programmer I work with had written a service that was vulnerable to SQL injection (purely by accident, I was using it and noticed how it was mishandling apostrophes).

      I think most programmers will do it sooner or later until either they've A) internalized the warnings from others, or B) been caught by someone noticing (and potentially exploiting) vulnerable code that they've written. And if neither A) nor B) happen immediately, they may well be serial abusers.

      Also a lot of programmers seem to forget that injection doesn't just apply to SQL. Shell command insertion is also a huge abuse target.

      • by unencode200x ( 914144 ) on Sunday November 22, 2015 @02:09PM (#50981015)
        It's irresponsible to continue to do this. With stored procedures, ORMs (there are some good ones out there, I use Linq a lot), and parameterized queries available in all the major languages I can't help but wonder if people are just incompetent.

        Also, validate and sanitize your input data man. If you're writing code for the web you *have* to do this, no excuses. Albeit, most "web developers" I've seen don't have a clue. Now, get off my lawn!
        • by OzPeter ( 195038 ) on Sunday November 22, 2015 @02:20PM (#50981051)

          It's irresponsible to continue to do this.

          I was browsing Stack Overflow the other day and looked at an SQL/PHP based question. The poor guy asking the question was obviously a n00b who was just starting to code, and had googled around to find a solution to his problem but it wasn't quite working for him (and hence the SO question).

          From what I saw the problem wasn't that he was a stupid n00b, it was that his googling had turned up horrendously bad PHP code (using ancient DB connection style code, plus totally SQL injection ready) and he didn't know the difference between that code and best practices. So it seems that part of the problem is the act of using google itself and how good code and bad code examples are presented as equals solely based on what ever google's page rank algorithm de jour is. And I can't see how you can fix that without purging google of all the bad code examples.

          • This just in, cargo-cult programming causes security holes.

            That's not really news, is it?

          • Damn you are right. I did the simple "mysql php tutorial", and except for the first hit (from W3Schools), ALL of them used the old, deprecated mysql_* functions and were wide open to SQL injection.

            Is there something the programmer's community ought to do? What could we do?

            • by i.r.id10t ( 595143 ) on Sunday November 22, 2015 @06:59PM (#50982463)

              As soon as PHP totally gets rid of the mysql_ family of functions, and forces everyone to convert to mysqli function/objects or PDO, it will fix itself. As a bonus, quite a few folks may make some beer money fixing all of the suddenly broken scripts...

              The problem with search results is that the mysql_ functions for a loong time were the only way to do the task, and with the plethora of tutorials/information out there the sheer number of them overwhelm the "new" stuff (mysqli and/or PDO)

              • Nope, switching to mysqli will not magically fix sql injections. The functions mysqli_query, mysqli::query and even mysqli::prepare allow for idiots to create broken code. Only if programmers are forced to separate the query from the data, it will be fixed. But that will never happen.

          • by Anonymous Coward

            This is a good point. There really is a lot of poor code out out there as examples, and basically no oversight for making sure it's *relevant*. On one hand, it's easy to assume that the crappy programmer who has to google up answers to his programming is to blame, but on the other hand this is very much a self-taught career/hobby for an absolute ton of people.

            This is also a problem with many "updated" programming books. I picked a PHP guide the other day, revised in early 2014, and it mentions SQL inject

        • by ranton ( 36917 )

          It's irresponsible to continue to do this. With stored procedures, ORMs (there are some good ones out there, I use Linq a lot), and parameterized queries available in all the major languages I can't help but wonder if people are just incompetent.

          While I agree there is no excuse to allow SQL injection attacks, some frameworks have some really horrendous parameterized query syntax. I recently had to use the node-postgres client for the first time a few weeks ago, and I was running into some tough situations that took far too long to figure out. There were times I was tempted to not use parameterized queries, but ultimately I knew the dangers of doing it the easy way.

          As long as the easy way to do things is not the same thing as the right way, these vu

        • by WaffleMonster ( 969671 ) on Sunday November 22, 2015 @05:25PM (#50982009)

          It's irresponsible to continue to do this. With stored procedures

          Does using stored procedures solve SQL Injection? Show of hands... all of you who raised yours are part of the problem.

          Also, validate and sanitize your input data man. If you're writing code for the web you *have* to do this, no excuses. Albeit, most "web developers" I've seen don't have a clue. Now, get off my lawn!

          The number of people who incorrectly believe SQL Injection is in any way related to data validation means the problem will never go away. SQL Injection is a failure to enforce context and has got exactly nothing to do with content.

          The data validation misinformation is so prevalent the only way you are probably even reading this is you regularly browse -1 as many of you will have modded my comment into oblivion.

        • The problem is that, in non-trivial applications, it's not always easy to tell *where* in the architecture the data should be sanitized. Security experts accidentally write SQLi. Web applications are especially problematic because you have to escape for so many different contexts. It's not possible to do it all in one place since, at the time of receipt, you don't know the context. Is it going into a database? One type of escaping is required. HTML context? Completely different. What if it's going t
        • by Rinikusu ( 28164 )

          There's a new found disdain for DBAs, because they "slow things down" by pointing out issues before they become issues. Instead, every half-assed "web developer" also thinks they're a DBA because "web scale" or some bullshit. I've always found it ironic that businesses who depend upon the integrity of their data are the first to eschew the services of a good DBA because "slow" or because "nosql". Then again, I've generally always worked with competent DBAs would who ask questions about my queries and hel

        • I wonder if aspiring developers are using out of date tutorials to write their code. The ones with zero input sanitization. You're right, though, there isn't really any excuse to not use stored procedures these days. Actually, scratch that. I hope to see the same shitty code so I can keep my App Pentesting day job. :)
      • by Anonymous Coward on Sunday November 22, 2015 @02:31PM (#50981093)

        You are absolutely right. I see this all the time as the hiring manager in a web shop. I always present candidates with this question:

        1. Find and fix the potential SQL injection vulnerability: // .. /*@var \PDO */
        protected $dbh; //..
        public function getOption($name)
                $sql = "SELECT val FROM options WHERE name = {$name}";
                $stmt = $this->dbh->prepare($sql);
                $stmt->execute();
                return $stmt->fetchColumn();
        }

        For those who don't know PHP, the answer is:
                $sql = "SELECT val FROM options WHERE name = ?";
                $stmt = $this->dbh->prepare($sql);
                $stmt->execute(array($name));

        Almost no candidates out of school even know what I'm asking them to do. About half of people with experience get it right; a quarter of them understand the question and get it wrong, and a quarter don't understand the question. I find that it doesn't matter how many years of experience they have, about a quarter of programmers just don't understand what SQL injection is.

        I just don't get it. I've spent more than a decade programming in PHP, the language that really made SQL injection a thing because it lacked prepared statements for a long, long time and even then a lot of the input escaping functions were broken. Over those years, I've picked up a lot of bad habits; some were dictated by the shortcomings of PHP4 ("dependency injection? what's that?"), others are a side effect of spending all of my time cranking out single purpose scripts that had to work yesterday ("Ctrl+C; ctrl+V").

        Nevertheless, it still blows my my mind when I encounter people in this day and age who aren't using prepared statements. Concatenating SQL is just so... messy. Seriously, it takes two minutes to write a nice, clean, understandable SQL statement as a string, and at most a three line loop to bind the values. If your are concatenating it together, you have a mess of loops and conditions (comma here?) and strings and array manipulations... It is so much more work.

        Yet I still hire jokers who can't do it because I need bodies to fill seats.

        • "For those who don't know PHP, the answer is:"

          Except when it isn't. What's the source of that $name parameter to your function? Has it been sanitized in any way? I can imagine your interviewees taking a punt on what kind of idiot they are facing. (Looks like he was born in 1955 so the answer is probably x)
          • by Anonymous Coward

            No. You are the reason that SQL injection still happens. It should be parameterized no matter what. It is a public method and as a developer you don't know where it is called from. Or where it will be called from in future iterations of your software. SQL string concatenation is inherently dangerous activity, an anti'pattern. If you absolutely must do it, then variables should be sanitized within the method that is concatenating the statement to avoid errors always.

        • It's not really an issue with prepared statements. Prepared statements are just a form of pre-compilation. You just want parameterized queries, which is sort of related (prepared statements are usually parameterized, but not always).

          Prepared statements are usually slower than non-prepared statements (depends on environment, database, etc), so if it is a one-off query that won't be reused then typically you don't want to prepare it. For queries you are calling over and over, or are calling repeatedly, the

          • Sorry, that should have read prepared statements incur an initial overhead, so for one-off queries they are slower, but actually executing them is faster.

      • by MobyDisk ( 75490 )

        I'm curious to know why a senior programmer was writing code to handle apostrophes in the first place when that is probably built-in to whatever library you use. I'm legitimately interested, if you wouldn't mind following-up with a reply at some point. The answer is probably to the heart of why SQL injection continues to be an issue.

        • by Rei ( 128717 ) on Sunday November 22, 2015 @06:40PM (#50982381) Homepage

          I think you're confused. They weren't "writing code to handle apostrophes". They wrote a code review-related microapp, and I noticed during the submission of a review that it failed, gave an detailed error message (which I should probably warn him is also bad practice, you don't help would-be hackers out by publicly such information) indicating a particular bad SQL statement, and the statement was "bad" because it wasn't sanitizing the apostrophes in my input. It was immediately clear that he was building his query through simple string concatenation.

          The application was designed for internal usage (though I'm not sure if it was externally accessible)... but even if it wasn't externally accessible, the fact that he would write SQL queries through string concatenation is a problem, in case he ever would write an externally-accessible application for us. I'm not disappointed or upset with him or anything, because lots of people do that, it's a natural way for someone who doesn't realize the risks to do it. People are used to building up strings through concatenation - for example, for displaying text in a GUI. A large chunk of programmers just don't know the risks that exist in certain contexts.

          • by MobyDisk ( 75490 )

            Hmmm... then I reword my question: "I'm curious to know why a senior programmer was writing code to concatenate strings of SQL." Fortunately, you answered it already when you said "It's a natural way for someone who doesn't realize the risks to do it." That is probably the most common reason for SQL injection vulnerabilities. But that statement concerns me. I expect someone labeled "senior engineer" would already know about these risks. Exceptions might be someone with a very narrow but deep focus like

      • by gbjbaanb ( 229885 ) on Monday November 23, 2015 @08:00AM (#50984419)

        The problem is inherent in many systems so you will always make a mistake until the day that you put all your queries into stored procedures.

        Treat the DB as a generic object pool of crap and it'll be that. Treat it like its a precious storage system with its own (customisable) API and you'll do far better.

        But of course, slapping SQL together in the client and sending it to the DB to parse and execute is so much easier everyone does it.

    • Fresh crop of computer science graduates should be those from which this should never happen. They are newly trained, supposed to be security awared. Particularily if they have to deal with web sites programming. This is the lamest excuse. I can rather than that old programmers getting a new assignement with web programming will not know how to circumvent such a problem even if they have heard about it in the news. Employers are often trying to save a few bucks on training of old farts.

      However, I believe th

    • This. In most companies I see few or no senior devs. What they call senior devs are people with a mere 5 years of experience. And management refuses to even let those so-called seniors set aside time to coach the junior coders. And then they wonder why so many projects fail to live up even to minimal expectations.
    • by hey! ( 33014 )

      What would be nice is if they learned about it before they develop habitual patterns for using a language/platform.

      The problem is that people who teach n00bs want to give them the success experience of updating a database early on, before they've learned about prepared statements and (the much broader topic) of checking user input. If they'd just stop that then over the course of years the problem would become much smaller.

    • Each year brings a fresh crop of computer science graduates into the industry, barely any of them having a clue about attacks like this. Many of them will make these mistakes and learn about defending against them the hard way.

      Maybe a few schools teach about this now. Maybe a few companies will pair senior devs with new devs to transfer this knowledge on the job. Even so, there will be enough new programmers who don't know this, and enough companies who eschew senior talent as a cost-savings measure, that this vulnerability will continue to rear its ugly head.

      It's not like they teach 'how to protect yourself from SQL injection' in school. In school, they teach people how to program in a clean room, where all data is 100% good and only one person at a time uses a system.

  • It is usually accomplished by accepting the lowest bidder.
    • by khasim ( 1285 )

      And in the private sector I've usually seen it accompanied by the boss saying "My friend/son/cousin knows this computer stuff. I'll get him to do it."

      • That's better, because nepotism is better than communism.

        Some parts of the US like nepotism so much they choose their spouses that way.

        • by AK Marc ( 707885 )
          Don't forget, one of the recent presidents was selected that way as well.
  • PHP (Score:5, Interesting)

    by Bogtha ( 906264 ) on Sunday November 22, 2015 @02:05PM (#50980991)

    So why, in 2015, is SQLi still leading to some of the biggest breaches around?

    Because typical PHP tutorials still teach old, broken ways of doing things and this shows no signs of abating. Go ahead and search the web for things like php mysql tutorial. The top hits are crap like this [freewebmasterhelp.com], written by incompetent developers who don't know what they are doing. PHP developers learn from crap like that, then they go on to write their own tutorials that are the same or worse.

    And before you start, yes, this is something where PHP is stand-out bad. Go ahead and try the same searches with other languages. There is a vast difference in quality of learning materials. I mean, PHP had XSS vulnerabilities in its official tutorials until relatively recently. Newbies don't stand a chance in those circumstances.

    • This is not a PHP thing, but a bad-developer thing. You can write the same crap in Java, .NET, Python or any language you want. PHP is easy to learn, easy to use and easy to deploy. That's why it has become so popular. Because PHP has so many users, it also has many incompetent users and incompetent users publishing their incompetence in bad tutorials. That's not PHP's fault.
      • Re:PHP (Score:5, Informative)

        by Bogtha ( 906264 ) on Sunday November 22, 2015 @04:42PM (#50981797)

        This is not a PHP thing, but a bad-developer thing.

        I guess you didn't read past my first paragraph? Please do.

        You can write the same crap in Java, .NET, Python or any language you want.

        Go and search the web for tutorials in those languages. You will find that the situation is vastly better with these languages compared with PHP.

        That's not PHP's fault.

        It is - on many fronts.

        Firstly, the language promoted for many, many years, a confusion between the various layers of the application. The whole magic quotes nonsense was an attempt to fix a problem relating to the database layer in the HTTP layer. This confused PHP developers for over a decade, and even though it has since been removed, it was in there for so long that an entire generation of PHP developers had their brains twisted out of shape with this confusion.

        Secondly, the official documentation was super bad for years. Security vulnerabilities in the official tutorial for years, for example.

        Thirdly, the API design is so bad it practically pushes unsuspecting developers into the wrong solution. addslashes()? No, use mysql_escape_string(). Oh wait, wasn't that mysql_real_escape_string()? Or perhaps mysql_really_really_i_promise_to_do_it_right_this_time_escape_string()?

        Finally, the PHP community right from the very top embraces shitty practices, like ignoring failing tests in a release build. Again, a source of security vulnerabilities that simply doesn't need to happen.

        Yes, you can write bad code in any language. But that doesn't mean that all languages are equal. PHP is far, far worse at this than its contemporaries and you shouldn't make excuses for it.

        • Re: (Score:3, Informative)

          Thirdly, the API design is so bad it practically pushes unsuspecting developers into the wrong solution. addslashes()? No, use mysql_escape_string(). Oh wait, wasn't that mysql_real_escape_string()? Or perhaps mysql_really_really_i_promise_to_do_it_right_this_time_escape_string()?

          To be fair to PHP here, the mysql_escape_string vs mysql_real_escape_string is mostly MySQLs fault (watch http://www.youtube.com/watch?v... [youtube.com] if you want an insight into how screwed up MySQLs development was). It's one of their old C libraries that added the mysql_real_escape_string function.

          PHP is not entirely blameless on this front; back in the early days of PHP Rasmus Lerdorf (PHP's creator - read and weep [wikiquote.org]) thought the best way to design an API is to just expose PHP's internal libraries' headers to PHP

          • Thinking about this a bit more, I've come to the conclusion that the PHP devs may have been correct to add the mysql_real_escape_string function instead of changing mysql_escape_string to invoke MySQLs mysql_real_escape_string (although not necessarily using their crappy name for it).

            There's actually a subtle difference in the expectations of the real_escape variant; it requires an active MySQL connection to be open in order to work, which the older escape function does not. It's not exactly common to tr

        • You forgot magic_quotes, lol.

        • I did. You're just wrong. That's why I wrote my comment.
    • Re:PHP (Score:4, Insightful)

      by phantomfive ( 622387 ) on Sunday November 22, 2015 @03:52PM (#50981495) Journal
      There's a quote from Theo de Raadt that is relevant here:

      “When you know exactly what the APIs are, you’ll spot the bugs very easily. In my mind, it is the same as any other job that requires diligence. Be careful. Humans learn from examples, and yet, in this software programming environment, the tremendous complexity breeds non-obvious mistakes, which we carry along with us, and copy into new chunks of code.
      We’ve even found in man pages where functions were mis-described, and when we found those, lots of programmers had followed the instructions incorrectly”

  • ...SQLi is relatively easy to defend against.

    Relatively? It's trivial to defend against (spoiler: use prepared statements), and anyone creating software that has even the potential for SQL injection is an incompetent moron.

    Hiring a programmer who doesn't know how to eliminate SQL injection is like hiring a surgeon who doesn't know how to use a scalpel, or a bridge builder who doesn't understand weight distribution. It's the first thing that a programmer should learn when learning to write database aware software.

    • by shess ( 31691 )

      Hiring a programmer who doesn't know how to eliminate SQL injection is like hiring a surgeon who doesn't know how to use a scalpel

      I'd say it's like hiring a surgeon who doesn't wash their hands before operations. Even if they otherwise do a bang-up job, they could still screw things up.

      [Though ... http://news.yahoo.com/clean-ha... [yahoo.com] ]

  • The Hiawatha webserver can block SQL injection [hiawatha-webserver.org] attacks. I like to hear what you think of it.

    • The Hiawatha webserver can block SQL injection attacks. I like to hear what you think of it.

      All heuristic attempts at blocking SQLi not only don't work but can themselves be leveraged as a vector for attack/denial.

    • Yahoo used (probably still uses) a modified Apache server that does a similar thing. From what I heard, it worked fine.
  • If people used perl and DBI with properly prepared statements, instead of [censored] php.

  • by Opportunist ( 166417 ) on Sunday November 22, 2015 @03:27PM (#50981357)

    No, I didn't write "a lack of people who write code". I exactly mean what I wrote: A lack of programmers.

    What we have today is a load of people who learned programming somehow, kinda-sorta, but without understanding just what they're doing. Now add how most of them gains information about how to do things. By looking it up on the internet. And taking the first solution that looks like it works.

    Of course it's easier to simply concat strings than using prepared statements and parameters. It is simply more readily understandable and less convoluted for people who have little knowledge and less time to gain it. And they don't know anything about security and why this could possibly be a security problem.

    These people are cheaper than people who know what they're doing. So much cheaper even that the additional time they need to get anything done is easily compensated. And whether it is a security problem is usually only found out after a security breach happens because, well, whoever hired them has even LESS knowledge about security.

    And since every year a new batch of people comes out of schools that kinda-sorta learned how to kinda-sorta do queries, this problem will mean job security for me 'til retirement.

    • Although I mostly agree with you, I feel compelled to put out that in order to write software today, one must know both the technical programming aspects *and* be an expert on the target domain model. The days of a business analyst writing requirements are over. The world changes too fast. If you're implementing tax software, the IRS publishes new rules and you have to be ready on January 1st. "Poor" code that implements the rules correctly is valuable. "Good" code that doesn't quite understand the dom
  • Pay peanuts (Score:5, Insightful)

    by TekPolitik ( 147802 ) on Sunday November 22, 2015 @04:13PM (#50981623) Journal

    Because businesses think software development in general, and especially web development, is easy. They hire monkeys and pay peanuts (or sometimes even serious dollars that could get them quality of they could recognise they were being taken for a ride), and we continue to see the most basic errors being repeated across most web sites. Seriously, the quality of web developers generally is absolutely appalling.

    • by readin ( 838620 )
      Exactly. Quality costs time and money. If you want to prevent SQL-Injection you not only need senior developers, you need an environment where they are encouraged to find problems in code and bring attention to it so people can learn from mistakes. Code reviews take time and money but customers don't want to pay for them. They may say they're willing to pay for code reviews but but they'll complain about the cost and hire someone else if you actually do them.
      • There are also many mistakes being made that demonstrate a basic lack of understanding, that cannot be attributed to lack of code review (my favourite example is email address validation code that assumes a TLD must have 2 or 3 characters).

    • by Tablizer ( 95088 )

      Those who make the decisions often focus on superficial things. I don't know a fix for that.

      I've seen people take sloppy shortcuts to put something visually snazzy up quick, and the clueless people who evaluate it think they are a Web-God.

      If one points out potential security, ADA, performance, maintenance, device-dependent problems, they are painted as jealous nay-sayers. It's happened to me many times.

      And those making the decisions expect to get promoted or hired away fairly soon; the long-term is not thei

  • by Lumpy ( 12016 ) on Sunday November 22, 2015 @05:03PM (#50981897) Homepage

    So why, in 2015, is SQLi still leading to some of the biggest breaches around?"

    Easy, idiots writing the apps because companies don't want to pay for skilled people that demand honest wages. they instead outsource ti for the lowest bidder and then bitch when they get crap quality because that is all they were willing to pay for.

    • by Greyfox ( 87712 )
      There's a lot more client/server going on, and a lot of programmers haven't discovered that you can't trust the client and are doing all their input validation and sanitation on the client side. As long as that's going on, this sort of attack is going to be popular. '); drop table articles.
    • they instead outsource ti for the lowest bidder and then bitch when they get crap quality because that is all they were willing to pay for.

      No they just hire the cheapest because they have no clue he/she is more or less competent than the more expensive candidates.

  • by Lobachevsky ( 465666 ) on Sunday November 22, 2015 @05:20PM (#50981989)

    There simply isn't any incentive for to build software that will last through some cyber attack some 10 months or 3 years into the future. The current incentives reward sloppily slapping together something that barely functions and gives a demo without crashing. If your demo crashes and makes the boss look bad, you're fired. If your demo works, has slick graphics and no spelling mistakes and the english dialog is polished, you get a raise. You're building software for the boss's demo, you're not building software that's robust, handles edge-cases, and input sanitizes everything. I meant, you could, but you're not getting paid any extra for it.

  • There is a ton of legacy code out there that was written before people worried about SQL injection. There's so much of it, going back and refactoring it would be as monumental as fixing the two-digit year problems of Y2K. Businesses really don't like to pay money for software development that doesn't lead to more sales, so it's a hard sell for IT departments. Sadly, this means that the problems don't get fixed until after a company loses money due to an actual attack.

  • Somewhere along the way we dispensed with DBAs and anyone else who might freak out at insecure access to the database layer. Glad that's working out.
  • I always wonder why people - even professionals (ableit only the non-DB pros) - think SQL is a feasible means for an application to utilise persistance. It isn't. In fact, it's a huge smelly turd for app-persistance and using it so broadly for this sort of work is a really harebrained and abysmally stupid idea.

    That we have to deal with SQL injection problems is one of the countless pieces of crap based on this technology decision.

    SQL was meant as an end-user interface for interacting with relational database - and for that it is absolutely perfect. End of story.

    Using SQL as intermediate for application persistance is one of the most annoying and studidest things in the history of applikation development - for reasons to countless to list them. DB designers are among those who time and time again shake their heads in disbelief when they see the mess devs do with SQL.

    • SQL was meant as an end-user interface for interacting with relational database - and for that it is absolutely perfect

      That argument was lost decades ago, man. Turns out SQL wasn't that great for end-users, but programmers kind of liked it.

    • Thank you. I've been saying this for years. I'm glad someone else can see that the Emperor has no clothes.

      SQL sucks. Not the concept of a relational database; that's something that's pretty cool. But the so-called "Structured Query Language" used to interact with the database is the worst affront to programming ever(*). It's not bad for user interaction, and I know it was an easy path to hacking in database support for languages that didn't have it. But for crying out loud, continuing to use it is just

  • The sad thing is that most programmers are still using simple string concatenation to write their SQL programmatically. In this modern day, that is beyond silly. If you use a DSL like jooq, you get several advantages. First off, all strings will automatically be bounded and avoid the simple injection tactics that most people use. Second, you can change databases on a whim by just changing the dialect. This is great for testing and using in memory databases for unit tests. If people just took that simp
  • Take a look at MVProc - http://mvproc.free-blog.net/ [free-blog.net] SQL Injection doesn't ever get a foothold, and it (the module) is very efficient with a tiny footprint. (Yes, I wrote it; and I'll take whatever feedback comes my way.)

Genius is ten percent inspiration and fifty percent capital gains.

Working...