Concatenate SQL string java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Concatenate SQL string java

27th Dec 2016, 2:14 AM
Syifa Alfi S
Syifa Alfi S - avatar
2 Answers
+ 2
You should really try using an ORM (Object Relational Mapper). This will save you a ton of time, reduce the number of errors and extra code you right by making it so you don't need to write any SQL by hand.
27th Dec 2016, 2:20 AM
James Durand
James Durand - avatar
+ 2
For Java it is recommended to use prepared Statements. http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html They protect you against Sql Injections. For simple concatenation use String res = string1+string2;
27th Dec 2016, 2:23 AM
Andreas K
Andreas K - avatar