---
title: "Struts2+Mybatis+Freemarker+Tiles架构灵活的开发框架(四)"
author: "suhongliang5332"
date: "2013-01-22T15:48:59Z"
tags: []
categories: ["企业架构"]
slug: "struts2-mybatis-freemarker-tiles"
draft: false
lastmod: "2013-01-22T17:04:15Z"
id: 1773805
url: "https://8586.iteye.com/blog/1773805"
---

接着继续来配置mybatis
第一，导入包
     classes12.jar
    mybatis-3.0.5.jar
第二，建一个配置文件db.properties

```properties

# DB
driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@你的地址：端口号：数据库SID
username=用户名
password=密码

```

第三，配置Configuration.xml

```xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration 
	PUBLIC "-//mybatis.org//DTD Config 3.0//EN" 
	"http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
	
	<properties resource="com/XXX/lib/mybatis/db.properties" />
	<typeAliases>

	</typeAliases>
	<environments default="development">
		<environment id="development">
			<transactionManager type="JDBC" />
			<dataSource type="POOLED">
				<property name="driver" value="${driver}" />
				<property name="url" value="${url}" />
				<property name="username" value="${username}" />
				<property name="password" value="${password}" />
			</dataSource>
		</environment>
	</environments>
	<mappers>

	</mappers>
</configuration>

```

特别说明:不明白请在下面跟帖，有错误的地方麻烦指正