Hibernate connection. driver_ Class attribute — specifies the database driver

hibernate. connection. driver_ Class = attribute value

Example 1

<property name="hibernate.connection.driver_class">
  com.microsoft.jdbc.sqlserver.sqlServerDriver
</property>
hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.sqlServerDriver

Example 2

<property name="hibernate.connection.driver_class">
  com.MysqL.jdbc.Driver
</property>
hibernate.connection.driver_class=com.MysqL.jdbc.Driver

Example 3

<property name="hibernate.connection.driver_class">
  oracle.jdbc.driver.OracleDriver
</property>
hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver

Typical application

<?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="dialect">org.hibernate.dialect.DerbyDialect</property><!--
设置查询sql语句使用方言-->
    <!--设置连接数据库URL-->
    <property name="connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=
      db_database11</property>
    <property name="connection.username">sa</property>
    <!--设置连接数据库用户名-->
    <property name="connection.password"></property><!--设置连接数据库密码-->
    <!--加载数据库驱动-->
    <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.
      sqlServerDriver</property>
    <property name="myeclipse.connection.profile">MyEclipse Derby</property>
  </session-factory>
</hibernate-configuration>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>