Looking for an embeddable SQL beautifier or reformatter [closed]

UPDATE 2:

org.hibernate.jdbc.util.BasicFormatterImpl got moved in release 4.0. It is now located at: org.hibernate.engine.jdbc.internal.BasicFormatterImpl.

UPDATE 1:

Technology marches on. As noted by Alex, org.hibernate.pretty.Formatter no longer exists as of version 3.3.2.GA. The replacement is org.hibernate.jdbc.util.BasicFormatterImpl:

String formattedSQL = new BasicFormatterImpl().format(sql);

ORIGINAL ANSWER:

If you’re using Hibernate, they’ve got one built-in: org.hibernate.pretty.Formatter

String formattedSQL = new Formatter(sql).format();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)