Ibatis configuration

1. db.properties
 driver=com.mysql.jdbc.Driver
 url=jdbc:mysql://localhost:3306/test
 username=root
 password=root


2. SqlMapConfig.xml
 <?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMapConfig      
    PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"      
    "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlMapConfig>
	<properties
		resource="conf/db.properties" />
	<settings cacheModelsEnabled="true" enhancementEnabled="true"
		lazyLoadingEnabled="true" maxRequests="32" maxSessions="10"
		maxTransactions="5" useStatementNamespaces="false" />

	<transactionManager type="JDBC">
		<dataSource type="SIMPLE">
			<property name="JDBC.Driver" value="${driver}" />
			<property name="JDBC.ConnectionURL" value="${url}" />
			<property name="JDBC.Username" value="${username}" />
			<property name="JDBC.Password" value="${password}" />
		</dataSource>
	</transactionManager>

	<sqlMap resource="conf/sqlmaps/employee.xml" />
	<sqlMap resource="conf/sqlmaps/site.xml" />
	
</sqlMapConfig>

你可能感兴趣的:(sql,mysql,xml,ibatis,jdbc)