15:29:08,990  WARN org.hibernate.util.JDBCExceptionReporter:100 - SQL Error: 1049, SQLState: 42000
15:29:08,991 ERROR org.hibernate.util.JDBCExceptionReporter:101 - Unknown database 'email'
org.hibernate.exception.SQLGrammarException: Cannot open connection

Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database 'email'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3269)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1182)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2670)

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory> <!-- Database connection settings -->
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://localhost/email
</property>
<property name="connection.username">root</property>
<property name="connection.password">flight</property> <!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">10</property> <!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property> <!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property> <!-- Disable the second-level cache  -->
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property> <!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping class="com.email.po.User" />
<mapping class="com.email.po.Message" />
<mapping class="com.email.po.ReceiveInfo" />
</session-factory></hibernate-configuration>SSHSQL数据库session

解决方案 »

  1.   

    Unknown database 'email'能看懂这几次词的意思吧!!!
      

  2.   

    Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database 'email'为什么写得这么明显看不懂,你数据库里面有email吗?
      

  3.   

    jdbc:mysql://localhost:3306/email 漏了端口吧
      

  4.   

    没有找到email数据库,貌似是漏了端口
      

  5.   

    Unknown database 'email'数据库名字你看对么?
      

  6.   

    jdbc:mysql://localhost/email
    自己看看,是否这个路径是对的?
      

  7.   

    哈哈,我要挨板砖了呀!我用create自动创建数据库,但是他不创建,最后在myeclipse中添加hibernate支持,然后还是不会自动创建!换何曾update更不能,最后手动在数据库里创建才完事儿了!声明一下,英文单词儿我看得懂哈!!!