原则上一条SQL只更新一条数据库操作,但有时需要批量操作数据,特别是一些DML语句,在操作数据库时,数据库会报出异常,不允许混合语句,此时需要额外配置进行兼容. 例如: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ve
1.准备数据库 创建数据库 create databases baodanjia; 创建帐号 create user 'baodanjia'@'%' identified by '123456' grant all privileges on baodanjia.* to 'baodanjia'@'%'; flush privileges; 创建表 mysql -ubaodanjia -p123456 use baodanjia; CREATE TABLE `admin` ( `id` varc
一 . 数据库中创建存储过程,并查看创建结果 1.创建存储过程 DROP procedure IF EXISTS net_procedure_request; DELIMITER $$ )) BEGIN ' THEN select client_ip,request_size_all,from_unixtime(start_time,'%Y年%m月%d日-%H时:%i分:%S秒') as startTime from net_table_request; ELSEIF select_type'
1.Oracle.MySQL插入时返回下一个主键的操作 Oracle:<insert id="insert" parameterClass="ROLE"><selectKey keyProperty="id" resultClass="java.lang.Long" type="pre"> SELECT SEQ_ROLE.NEXTVAL AS ID FROM DUAL</se
本文记录使用Mybatis操作数据库时碰到的一些语句,供以后参考. 一,多条件查询 示意SQL语句:SELECT t_field1, t_field2 FROM table_name WHERE t_field3 (BETWEEN startTime AND endTime) AND t_field4 IN (xxx,xxx,xxx) Mapper接口配置: public List<Chat> query(@Param("startTime") long startTime