解决myeclipse4.1.1对一个表生成映射文件的时候,出现“generating artifacts"的解决!

很多人在用myeclipse4.1.1对一个表生成映射文件的时候,都出现“generating artifacts"的问题。我也遇到了这个问题,弄得我也很郁闷!
看了很多人的帖子后还是无法搞定。最后通过查看.metadata\.log文件发现出现如下错误提示:
!ENTRY org.eclipse.core.runtime 4 2 2006-11-06 17:08:56.78
!MESSAGE An internal error occurred during: "Generating Artifacts".
!STACK 0
org.hibernate.exception.SQLGrammarException: Could not get list of tables from database. Probably a JDBC driver problem.
Configured schema:null
Configured catalog:Default Catalog
Available schemas:
Available catalogs:
  information_schema
  ito
  libraryweb
  mysql
  schoolproject
  test

 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
 at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:94)
 at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:395)
 at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65)
 at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration$1.readDatabaseSchema(MEJDBCMetaDataConfiguration.java:102)
 at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:87)
 at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:129)
 at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$5.execute(GenerateArtifactsJob.java:405)
 at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
 at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
 at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:400)
 at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:266)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Caused by: java.sql.SQLException: Syntax error or access violation,  message from server: "Unknown database 'default catalog'"
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1876)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1098)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1192)
 at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1153)
 at com.mysql.jdbc.Connection.execSQL(Connection.java:2048)
 at com.mysql.jdbc.Connection.execSQL(Connection.java:2005)
 at com.mysql.jdbc.Statement.executeQuery(Statement.java:1156)
 at com.mysql.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:3342)
 at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:70)
 ... 11 more

看来真是数据库驱动惹得祸。我的配置是:Eclipse3.1.2+MyEclipse4.1.1+MySQL5.0.12。数据库驱动用的是最新的mysql-connector-java-5.0.4-bin.jar。为什么还出现这样的问题,真是奇怪。
最后试着将DB-browser在连接时的配置页schema datails设置为dispaly all schema时然后再连接,结果就可以对表生成映射文件。
看来真是奇怪亚。
希望大家在遇到这个问题的时候,注意看一下eclipse\workspace\.metadata.metadata\.log文件,可以根据错误提示解决问题。

你可能感兴趣的:(MyEclipse)