spring dataSource 配置
spring dataSource 配置
mysql <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/Hibernian</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">sa</property> </session-factory> </hibernate-configuration> spring mssql <bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/> <property name="url" value="jdbc:jtds:sqlserver://localhost:1433/数据库名"/> <property name="username" value="sa" /> <property name="password" value="sa" /> </bean> spring mysql <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/数据库名"/> <property name="username" value="sa" /> <property name="password" value="sa" /> </bean> spring oracle <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@1ocalhost:1521:数据库名"/> <property name="username" value="sa"/> <property name="password" value="sa"/> </bean> |