首页 > 代码库 > 连接oracle和mysql数据库

连接oracle和mysql数据库

<?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">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<!--  连接mysql -->
<session-factory>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/oa1
</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="eclipse.connection.profile">mysql</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping resource="com/oa/domain/Person.hbm.xml" />
</session-factory>

<!-- 连接oracle -->
<session-factory>
<property name="dialect">
org.hibernate.dialect.Oracle10gDialect
</property>
<property name="connection.url">
jdbc:oracle:thin:@LOCALHOST:1521:ORCL
</property>
<property name="connection.username">oa1</property>
<property name="connection.password">oa1</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="eclipse.connection.profile">oracle</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>

<mapping resource="com/oa/domain/Person.hbm.xml" />
</session-factory>
</hibernate-configuration>

连接oracle和mysql数据库