在线音乐网站---(could not execute query)数据库查询错误
2013-03-21 08:59
453 查看
昨天我在配置一个由java语言编写的在线音乐网站时,出现了一下错误,org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query-----org.hibernate.exception.SQLGrammarException:
could not execute query------com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'music.song' doesn't exist,然后我就去网上找解决方法,然后搜索发现,很多人都遇到了这个错误,网上普遍的答案是jar包的冲突,我就根据他们的方法删除包,弄了几个小时还是不行。
最后我就放弃他们的做法,自己看了看错误的提示,结果大吃一惊,最好一句提示“Table 'music.song' doesn't exist”,是表不能被找到,我打开song.hbm.xml文件后,我看见了这条语句<class name="Song" table="SONG" schema="music">,我就明白了,我创建数据库时,没有创建一个叫“music"的schema,所以就不能找到music.song表格,于是我就把shema="music“删了,检查了下其它的*.hbm.xml,都没有之后,我重新部署到tomacat,结果成功了
虽然可以成功部署之后,但是上次歌曲到数据库时,出现乱码,经常一番查找之后,问题是“插入数据库时出现乱码”,所以我吧datasource改成<property name="url">
<value>jdbc:mysql://localhost:3306/db_music?useUnicode=true&characterEncoding=UTF-8</value>,之后就没有出现乱码问题了,希望能给大家一点帮助。
could not execute query------com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'music.song' doesn't exist,然后我就去网上找解决方法,然后搜索发现,很多人都遇到了这个错误,网上普遍的答案是jar包的冲突,我就根据他们的方法删除包,弄了几个小时还是不行。
最后我就放弃他们的做法,自己看了看错误的提示,结果大吃一惊,最好一句提示“Table 'music.song' doesn't exist”,是表不能被找到,我打开song.hbm.xml文件后,我看见了这条语句<class name="Song" table="SONG" schema="music">,我就明白了,我创建数据库时,没有创建一个叫“music"的schema,所以就不能找到music.song表格,于是我就把shema="music“删了,检查了下其它的*.hbm.xml,都没有之后,我重新部署到tomacat,结果成功了
虽然可以成功部署之后,但是上次歌曲到数据库时,出现乱码,经常一番查找之后,问题是“插入数据库时出现乱码”,所以我吧datasource改成<property name="url">
<value>jdbc:mysql://localhost:3306/db_music?useUnicode=true&characterEncoding=UTF-8</value>,之后就没有出现乱码问题了,希望能给大家一点帮助。
相关文章推荐
- hibernate使用HibernateCallback 回调的方法查询SQL时could not execute query--作怪的别名
- 从数据库方面解决org.hibernate.exception.JDBCConnectionException:could not execute query
- hibernate错误:could not execute native bulk manipulation query
- 数据库长时间未操作自己断开org.hibernate.exception.JDBCConnectionException: could not execute query
- pg_restore: [归档 (db)] could not execute query: 错误: 语言 "plpgsql" 已经存在
- web程序本地通过ip地址链接不到数据库oracle11g,异常错误 The Network Adapter could not establish the connection
- 数据库连接错误集锦A ResourcePool could not acquire a resource from its primary factory or source
- org.hibernate.exception.SQLGrammarException: could not execute query
- 数据库连接错误The Network Adapter could not establish the connection
- jdbc+executeQuery实现数据库查询
- 数据库异常整理:org.hibernate.QueryException: could not resolve property: “xxx”
- wampServer2.1错误(Could not execute menu item (internal error) [Exception] Could not perform service action 服务尚未启动)
- 解决SVN提交代码时的错误:“Could not execute PROPPATCH”
- 用Struts+DAO+Hibernate+MySql写的程序发生:org.hibernate.exception.DataException:Could not execute JDBC batch update的错误原因
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update错误
- 异常积累:org.hibernate.exception.SQLGrammarException: could not execute query-hibernate解释后的sql语句有问题
- org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query
- struts “could not execute statement; SQL [n/a]; constraint [null];” 错误