How to truncate a table with Spring JdbcTemplate?

Posted by Marcus on Stack Overflow See other posts from Stack Overflow or by Marcus
Published on 2010-05-24T20:16:30Z Indexed on 2010/05/24 20:21 UTC
Read the original article Hit count: 1422

Filed under:
|
|

I'm trying to truncate a table with Spring:

jdbcTemplate.execute("TRUNCATE TABLE " + table);

Get the error:

Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [TRUNCATE TABLE RESULT_ACCOUNT]; nested exception is java.sql.SQLException: Unexpected token: TRUNCATE in statement [TRUNCATE]

Any ideas?

© Stack Overflow or respective owner

Related posts about spring

Related posts about truncate