The connection property 'zeroDateTimeBehavior' only accepts values of the form: 'ex

前景概述:

表user_info中created_time 設計爲:

created_time timestamp not null default current_timestamp;

java插入數據時沒有填寫createdTime字段

就拋出

Cause: java.sql.SQLException: The connection property 'zeroDateTimeBehavior' only accepts values of the form: 'exception', 'round' or 'convertToNull'. The value 'convertToNull ' is not in this set.

原因在這裏:注意url的value值的最後有一個空格

<environments default="development">  
        <environment id="development">  
            <transactionManager type="JDBC"/>    
            <dataSource type="POOLED">  
                <property name="driver" value="com.mysql.jdbc.Driver"/>  
                <property name="url" value="jdbc:mysql://localhost:3306/foretaste?zeroDateTimeBehavior=convertToNull "/>  
                <property name="username" value="root"/>  
                <property name="password" value="mysql123"/>  
            </dataSource>  
        </environment>  
    </environments>

去掉這個空格就可以了.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章