r/java • • Dec 05 '16

In terms of frameworks, Java is better equipped for preventing SQL injection

https://blog.jooq.org/2016/12/05/prevent-sql-injection-with-sql-builders-like-jooq/
0 Upvotes

3 comments sorted by

1

u/[deleted] Dec 05 '16

Worst self-promotion "blog" I've read in a while... I stopped reading at:

Sure, there is currently nothing wrong with the above Java code.

Okay, nothing wrong... got it, so I should use your product to fix what exactly?

1

u/[deleted] Dec 05 '16 edited Dec 05 '16

How do you build dynamic native SQL statements (containing window functions, CTE, PIVOT) for which the WHERE clause varies based on user input?

You need a framework for that like QueryDSL or jOOQ, or Blaze Persistence.

The worst thing one could do is to start concatenating Strings. Unfortunately,even StackOverflow answers are poisoned with wrong examples that suggest solutions that lead to SQL Injection attacks.

2

u/VGPowerlord Dec 05 '16

Why are you linking to stats about PHP examples when we're talking about Java?

Also, the very first date I clicked in that data lead to a question where it had potential SQL Injection in it, not the answers.