org.springframework.dao.DataAccessResourceFailureException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • h4. Status Quo The following lines from an SQL script worked with the {{EmbeddedDatabaseBuilder}} until I updated to the latest nightly snapshot ({{org.springframework.jdbc-3.0.4.BUILD-20100810.004442-53}}). {code:title=No longer working} INSERT INTO users(email_address, password, first_name, last_name, roles) values('sam.brannen@example.com', '$pr!ng', 'Sam', 'Brannen', 'ROLE_USER,ROLE_ADMIN'); {code} Execution of this script results in the following stacktrace: {code:title=Stacktrace} org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is java.sql.SQLException: Unexpected token INTOUSERS, requires INTO in statement [INSERT INTOusers] at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.populateDatabase(EmbeddedDatabaseFactory.java:158) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.initDatabase(EmbeddedDatabaseFactory.java:138) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.getDatabase(EmbeddedDatabaseFactory.java:114) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder.build(EmbeddedDatabaseBuilder.java:112) {code} Removing the newline between {{INTO}} and {{users}} (as in the following script) works. Thus, recent changes (from 3.0.3 - 3.0.4) now swallow {{\n}} in SQL scripts, effectively concatenating adjacent lines. {code:title=Working} INSERT INTO users(email_address, password, first_name, last_name, roles) values('sam.brannen@example.com', '$pr!ng', 'Sam', 'Brannen', 'ROLE_USER,ROLE_ADMIN'); {code} h4. Proposed Solution {{ResourceDatabasePopulator}} should be modified to properly interpret _empty lines_ in contrast to simply swallowing all {{\n}} characters.
    via by Sam Brannen,
  • h4. Status Quo The following lines from an SQL script worked with the {{EmbeddedDatabaseBuilder}} until I updated to the latest nightly snapshot ({{org.springframework.jdbc-3.0.4.BUILD-20100810.004442-53}}). {code:title=No longer working} INSERT INTO users(email_address, password, first_name, last_name, roles) values('sam.brannen@example.com', '$pr!ng', 'Sam', 'Brannen', 'ROLE_USER,ROLE_ADMIN'); {code} Execution of this script results in the following stacktrace: {code:title=Stacktrace} org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is java.sql.SQLException: Unexpected token INTOUSERS, requires INTO in statement [INSERT INTOusers] at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.populateDatabase(EmbeddedDatabaseFactory.java:158) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.initDatabase(EmbeddedDatabaseFactory.java:138) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.getDatabase(EmbeddedDatabaseFactory.java:114) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder.build(EmbeddedDatabaseBuilder.java:112) {code} Removing the newline between {{INTO}} and {{users}} (as in the following script) works. Thus, recent changes (from 3.0.3 - 3.0.4) now swallow {{\n}} in SQL scripts, effectively concatenating adjacent lines. {code:title=Working} INSERT INTO users(email_address, password, first_name, last_name, roles) values('sam.brannen@example.com', '$pr!ng', 'Sam', 'Brannen', 'ROLE_USER,ROLE_ADMIN'); {code} h4. Proposed Solution {{ResourceDatabasePopulator}} should be modified to properly interpret _empty lines_ in contrast to simply swallowing all {{\n}} characters.
    via by Sam Brannen,
    • org.springframework.dao.DataAccessResourceFailureException: Failed to populate database; nested exception is java.sql.SQLException: Unexpected token INTOUSERS, requires INTO in statement [INSERT INTOusers] at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.populateDatabase(EmbeddedDatabaseFactory.java:158) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.initDatabase(EmbeddedDatabaseFactory.java:138) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory.getDatabase(EmbeddedDatabaseFactory.java:114) at org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder.build(EmbeddedDatabaseBuilder.java:112)
    No Bugmate found.