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

荒凉一梦 提交于 2019-12-08 21:04:58

问题


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>

Thank you.


回答1:


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:...



来源:https://stackoverflow.com/questions/11074537/jdbc-initialize-database-cant-find-script-files-dataaccessresourcefailureexce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!