2

私はmysqlを使用しようとしているので、mysql.jdbcを含めてください。これらは私の休止状態の設定です。

<?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>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/TekirMobile</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">fenderpass</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
      </session-factory>
    </hibernate-configuration>

しかし、データベースに接続しようとすると、次のエラーが発生します。

Unable to connect: Cannot establish a connection jdbc:mysql://localhost:3306/mydbname using apache.org.derby.jdbc.ClientDriver(Unable to find a suitable driver)

ダービーを使用していないのに、なぜこのエラーが発生するのですか?

4

1 に答える 1

0

接続ドライバーをどこにも指定していません。を使用して接続しようとしていることを示していますapache.org.derby.jdbc.ClientDriver

次の方法で、MySQL ドライバーを指定します。

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
于 2013-03-24T16:02:25.777 に答える