使用abator配置iBatis,管理数据库(以MySql为例)
相信很多的朋友对使用iBatis管理数据库很不习惯,因为我们要手写代码,特别是dynamic
query部分更是不知如何嵌套,而这些是可以用工具的!下面介绍一种最常用的!不废话了,直接上配置过程!
1、获得 http://ibatis.apache.org/abator.html
Eclipse可以自动的进行Update获取此Plugin,官方的安装步骤.
If you've already installed a prior version of Abator, simply run the Eclipse Install/Update tool and the new version will be found automatically.
If you've not already installed Abator, then you can use the built in Eclipse install support by following these steps:
Take the "Help>Software Updates>Find and Install" Menu Option
Select the "Search for new features to install" radio button, press "Next"
Press the "New Remote Site" button
Enter the following information:
Name:
Abator for Eclipse Update Site
URL:
http://ibatis.apache.org/tools/abator
Press OK
Check the box next to "Abator for Eclipse Update Site"
Follow the remainder of the install wizard
2、安装好后将在New菜单中看到一个新的文件类型Abator for iBATIS Configuration
File,此是Abator的配置文件,配置文件的详细说明见http://ibatis.apache.org/docs/tools/abator/
3、新建一个配置文件,进行修改,根据自己的实际需求进行修改
关键点:
1)jdbc
connection,按照一般的配置即可,需要说明的是它需要指定访问JdbcDriver的classPathEntry,对于MsSqlServer而言,要将这三个jar文件均包含在内,否则会出现jdbc访问错误。
2)配置三个Pakage
3)配置表,此处需说明的是对于MsSqlServer不能写TableSchema,我初次指定TableSchema,结果未找到对应的表
简单的配置如下,复杂的见配置文件的详细说明。示例配置文件如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Abator for iBATIS Configuration 1.0//EN"
"http://ibatis.apache.org/dtd/abator-config_1_0.dtd">
<abatorConfiguration>
<abatorContext generatorSet="Java5">
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://local
相关文档:
使用整数数据的精确数字数据类型。
bigint
从 -2^63 (-9223372036854775808) 到 2^63-1 (9223372036854775807) 的整型数据(所有数字)。存储大小为 8 个字节。
int
从 -2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,647) 的整型数据(所有数字)。存储大小为 4 个字节。int 的 SQL-92 同义字为 integer。
smallin ......
经常在一个表中有父子关系的两个字段,比如empno与manager,这种结构中需要用到树的遍历。在Oracle 中可以使用connect by简单解决问题,参见http://blog.csdn.net/wzy0623/archive/2007/06/18/1656345.aspx,但MySQL 5.1中还不支持(据说已纳入to do中),要自己写过程或函数来实现。
一、建立测试表和数据:
DROP TABLE ......
这几天做一个查询,需要在一个指定的结果集中进行查询,例如:
select * from table_name where doc_id IN ('1dba', 'c20a', '907b')
其中IN子句中的doc_id列表是通过调用一个外部接口获得一组doc_id常量列表,然后在本地库中搜索符合这个列表的数据
记录。后来发现mysql返回的结果集的排序是按照入库顺序给出的,但是我 ......
http://hi.baidu.com/tianxia_1209/blog/item/a2613822fec7e7f6d6cae267.html
MYSQL的事件是5.1新增加的,如果想体验,建议升级版本。
至于语法我就不多说了,手册上讲的很详细,我来说说几个要点以及一些实例。
注意事项:
1、EVENT权限是针对模式的(在MYSQL中也就是库的级别),不能对单独表来赋予权限。
2、必须在 ......
第五章 代码重用与函数编写
require()或include()可以将一个文件载入到php脚本中。
这两个函数几乎等价,唯一的区别是调用失败后require()给出一个致命错误,而include()只给出一个警告。
如果Web页面具有一致的外观,可以将相同的部分分离到单独的页面中,然后可以在php中使用require()语句将模板元素加入到页面中。
......