hibernate.cfg.xml的一般连接
<hibernate-configuration>
<session-factory name=“java:/hibernate/HibernateFactory”>
<property name=“show_sql”>true</property>
<property name=“connection.driver_class”>org.gjt.mm.mysql.Driver</property>
<property name=“connection.url”>jdbc:mysql://192.168.0.107/uni</property>
<property name=“connection.username”>admin</property>
<property name=“connection.password”>pass</property>
<property name=“hibernate.dialect”>net.sf.hibernate.dialect.MySQLDialect</property>
<!--Mapping files-->
<Mapping resource=”com/my/project/Users.hbm.xml”/>
</session-factory>
</hibernate-configuration>
连接池方式
<session-factory>
<property name=“connection.datesource”>java:comp/env/jdbc/EBTpool</property>
<property name=“show_sql”>false</property>
<property name=“user_outer_join”>true</property>
<property name=“dialect”>net.sf.hibernate.dialect.MySQLDialect</property>