Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jdbc-initialize-database can't find script files - DataAccessResourceFailureException

I cannot get my Spring web app to find my scripts. I have the jdbc namespace configured. I have the scripts written, but, I can't figure out why no matter where I put the scripts, they can't be found. I've specifically marked folders are 'class folders'. I've put them in the same folderr as all my jars... I've thrown a hundred rocks. It's almost as though the error listed is not really my error.

This should be so simple, but sometimes, I just hit stumps.

Ultimately, I'm trying to get code in place so I can initialize a database I've promoted to CloudFoundry.

I get "Cannot read SQL script from class path resource [etcog-schema.sql]". This is my code--just like every other example I've found.

<jdbc:initialize-database data-source="dataSource">
  <jdbc:script location="classpath:etcog-schema.sql"/>
  <jdbc:script location="classpath:etcog-data.sql"/>
</jdbc:initialize-database>
like image 540
Davidson Avatar asked Jun 17 '12 20:06

Davidson


1 Answers

If you are using STS and if you have created your application using the Spring Templates, then if you just put your *.sql file(s) inside src/main/resources, you should be able to access them via classpath:...

like image 136
Ali Moghadam Avatar answered Nov 12 '22 12:11

Ali Moghadam