Cleanest way to build an SQL string in Java
Posted
by Vidar
on Stack Overflow
See other posts from Stack Overflow
or by Vidar
Published on 2008-12-16T09:44:37Z
Indexed on
2010/04/09
14:03 UTC
Read the original article
Hit count: 334
I want to build an SQL string to do database manipulation (updates, deletes, inserts, selects, that sort of thing) - instead of the awful string concat method using millions of "+"'s and quotes which is unreadable at best - there must be a better way.
I did think of using MessageFormat - but its supposed to be used for user messages, although I think it would do a reasonable job - but I guess there should be something more aligned to SQL type operations in the java sql libraries.
Would Groovy be any good?
Any help much appreciated.
© Stack Overflow or respective owner