关于ibatis的问题,运行时抛出异常提示SimpleDataSource: Some properties were not set
我的配置大家看看sqlMapConfig.xml<sqlMapConfig><propertiesresource="com/ibatis/SqlMap.properti...
我的配置大家看看
sqlMapConfig.xml
<sqlMapConfig>
<properties resource="com/ibatis/SqlMap.properties" />
<settings cacheModelsEnabled="false" enhancementEnabled="true"
lazyLoadingEnabled="true" errorTracingEnabled="true" maxRequests="32"
maxSessions="10" maxTransactions="5" useStatementNamespaces="true" />
<transactionManager type="JDBC" commitRequired="true">
<dataSource type="SIMPLE">
<property name="${driver}" value="JDBC.Driver" />
<property name="${url}" value="JDBC.ConnectionURL" />
<property name="${username}" value="JDBC.Username" />
<property name="${password}" value="JDBC.Password" />
<property name="${defaultautocommit}" value="JDBC.DefaultAutoCommit"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/ibatis/Student.xml" />
-------------------------------------------------------------------------------------------------
SqlMap.properties
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/Myibatis
username=root
password=123456789
defaultautocommit=true
-----------------------------------------------------------------------------------------------
Student.xml
<sqlMap>
<typeAlias alias="Student" type="com.bean.Student" />
<select id="selectAllStudent" resultClass="Student">
select * from student
</select>
</sqlMap> 展开
sqlMapConfig.xml
<sqlMapConfig>
<properties resource="com/ibatis/SqlMap.properties" />
<settings cacheModelsEnabled="false" enhancementEnabled="true"
lazyLoadingEnabled="true" errorTracingEnabled="true" maxRequests="32"
maxSessions="10" maxTransactions="5" useStatementNamespaces="true" />
<transactionManager type="JDBC" commitRequired="true">
<dataSource type="SIMPLE">
<property name="${driver}" value="JDBC.Driver" />
<property name="${url}" value="JDBC.ConnectionURL" />
<property name="${username}" value="JDBC.Username" />
<property name="${password}" value="JDBC.Password" />
<property name="${defaultautocommit}" value="JDBC.DefaultAutoCommit"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/ibatis/Student.xml" />
-------------------------------------------------------------------------------------------------
SqlMap.properties
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/Myibatis
username=root
password=123456789
defaultautocommit=true
-----------------------------------------------------------------------------------------------
Student.xml
<sqlMap>
<typeAlias alias="Student" type="com.bean.Student" />
<select id="selectAllStudent" resultClass="Student">
select * from student
</select>
</sqlMap> 展开
1个回答
展开全部
<property name="${driver}" value="JDBC.Driver" />
<property name="${url}" value="JDBC.ConnectionURL" />
<property name="${username}" value="JDBC.Username" />
<property name="${password}" value="JDBC.Password" />
<property name="${defaultautocommit}" value="JDBC.DefaultAutoCommit"/>
这个地方貌似写反了,name和value的值颠倒下试试。
<property name="${url}" value="JDBC.ConnectionURL" />
<property name="${username}" value="JDBC.Username" />
<property name="${password}" value="JDBC.Password" />
<property name="${defaultautocommit}" value="JDBC.DefaultAutoCommit"/>
这个地方貌似写反了,name和value的值颠倒下试试。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询