apache dbcp mysql数据源配置

<bean id="MyDataSource" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver">
		</property>
		<!-- property name="url" value="jdbc:mysql://localhost/fireflow2?useUnicode=true&characterEncoding=UTF8" -->
		<property name="url" value="jdbc:mysql://localhost/fireflow2?useUnicode=true&amp;characterEncoding=UTF8">
		</property>
		<property name="username" value="root"></property>
		<property name="password" value="mysql"></property>
	</bean>


弄半天老是出问题,终于找到错误原因"&"在xml中定义要进行转义"&amp;"。唉,白花了两小时。郁闷!

你可能感兴趣的:(java,apache,xml,mysql,jdbc)