這樣寫的時候起作用:
<? xml版本=“ 1.0”編碼=“ utf-8”? > <! doctype configuration public“ - // mybatis.org//dtd config 3.0 // en”“ type =“ com.hc.entity.userinfo”別名=“ userInfo”/> </typealiases> <環境默認=“開發”> <環境id =“ mysql”> <transactionManager type =“ jdbc” jdbc“ jdaSource”/> <dataSource type type propert =“ propity name =” com.mys =“ com.mys” name =“ url” value =“ jdbc:mysql:// localhost:3306/db_mybatis”/> <屬性名稱=“ username” value =“ hhc”/> <property name =“ password” values =“ password” valit resource =“ com/hc/mapper/userInfo.xml”/> </mappers> </configuration>
這樣寫不起作用:
jdbc.driverClass = com.mysql.jdbc.driver jdbc.url = jdbc:mysql:// localhost:3306/db_mybatis jdbc.username = hc jdbc jdbc.pass jdbc.password = 123456 “ - // mybatis.org//dtd config 3.0 // en”“” http://mybatis.org/dtd/mybatis-3-config.dtd“> <configuration> <properties resources resource resource =” jdbc.properties> jdbc.properties> alias =“ userInfo”/> </typealiases> <環境默認=“開發”> <環境id =“ mysql”> <transactionManager type =“ jdbc”> </transactionManager> <dataSource> <dataSource type> pliomed =“ pooled”> <property name =“ drial =” drial =“ dround” valit value =“ $ {jdbc.url}”/> <property name =“用戶名” value =“ $ {jdbc.username}”/> <property name =“ password” value =“ $ {jdbc.password}” $ {jdbc.password} resource =“ com/hc/mapper/userInfo.xml”/> </mappers> </configuration>解決方法:
1.在jdbc.properties鼠標右鍵屬性(屬性),把ISO-8859-1更改為UTF-8
2.在整個項目鼠標右鍵,ISO-8859-1更改為UTF-8
總結
mybatis使用jdbc.properties文件設置不起作用的解決方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!