Java-bug点滴记录(四)

1.Session共享域:

HttpSession session = req.getSession();
session.setAttribute("id",id);

HttpSession session = req.getSession();
session.getAttribute("id");

2.没有提交事务!SqlSession.commit();

删除操作的数据库操作,没有提交事务,sqlSession.commit(); 2个小时才想到!!!!!

3.将表格名字的字母打错了,所以sql语句无法执行:

Query : INSERT INTO atu VALUES('S_1006','chener',16,'female')
Error Code : 1146
Table 'querydb.atu' doesn't exist
Execution Time : 00:00:00:000
Transfer Time  : 00:00:00:000
Total Time     : 00:00:00:000

4.在使用返回值在一张表上的内部sql语句时:

(1)is not null;
	 is null;
	 这样的判断时,要在第一个条件判断where后加 not null 不可在 最后一个		 where加判断然后再返回。
(2)返回值不是一个时要用in接收,不可使用等号接收。
SELECT * FROM stu WHERE sid IN ('S_1005','S_1006','S_1001');

5.基本SQL语句的使用方法:

插入数据:
insert into 表名 value (值);
INSERT INTO s

猜你喜欢

转载自blog.csdn.net/qq_37967304/article/details/103388662