0
錯誤我試圖連接到MySQL服務器,但出現此錯誤。當mydb是系統中唯一的名稱時。請告訴我,我錯了......「未知的數據庫‘MYDB’」使用JPA
我的堅持XML是便接踵而來:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="MyPersistenceUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/mydb" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="tft" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="true" />
</properties>
</persistence-unit>
</persistence>
是不是你錯了展示的persistence.xml?或者至少,這是我的眼睛告訴我的;-) – Riduidel 2010-03-16 10:49:05
你的數據庫起來了嗎?你能夠使用其他客戶端連接嗎?什麼是完整的異常堆棧跟蹤? – saugata 2010-03-16 10:56:14