简体   繁体   中英

Configuring mysql url in java

org.apache.commons.dbcp.SQLNestedException:无法创建 PoolableConnectionFactory(连接属性“autoReconnect”只接受以下形式的值:“true”、“false”、“yes”或“no”。值“true;connectTimeout= 360000;socketTimeout=360000' 不在这个集合中。)

& is a special character in XML and needs to be escaped as & . Try the following configuration:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost/db?autoReconnect=true&amp;connectTimeout=360000&amp;socketTimeout=360000" />
    <property name="username" value="root" />
    <property name="password" value="mysql" />
    <property name="initialSize" value="5" />
    <property name="maxActive" value="10" />
</bean>

See How do I include &, <, > etc in XML attribute values .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM