如何为 sql 服务器配置休眠配置文件
2022-09-01 01:17:47
以下是MySQL的配置文件:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">zgy01</property>
<property name="hibernate.connection.pool_size">100</property>
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="model.hbm.xml"/>
</session-factory>
</hibernate-configuration>
要为 SQL Server 2005 指定什么?我是这样做的:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.url">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">lal</property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.pool_size">100</property>
<property name="show_sql">false</property>
<!-- Mapping files -->
<mapping resource="model.hbm.xml"/>
</session-factory>
</hibernate-configuration>
我的问题更准确地说是如何指定我必须连接到的数据库?
在MySQL中,我曾经这样做过:
<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>