20165325 2017-2018-2 《Java程序设计》第七周学习总结

一、教材学习笔记

ch11

1、连接数据库

2、条件与排序查询:

  • where子语句

一般格式:select 字段 from 表名 where 条件

排序:用order by子语句对记录排序

3、更新、添加与删除操作

  • 更新

update 表 set 字段 = 新值 where <条件子句>

  • 添加

insert into 表(字段列表) values (对应的具体的记录)insert into 表 values (对应的具体的记录)

  • 删除

delete from 表名 where <条件子句>

4、使用预处理语句

5、事务

  • setAutoCommit(booean b):方法关闭自动提交模式
  • commit():方法处理事务
  • rollback():方法处理事务失败

二、码云链接

码云链接

三、代码托管截图


附:遇到的问题及部分解决方法

安装MySQL:在执行mysqld --initialize-insecure指令时出错

错误信息:

mysqld: Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually, or turn off
logging for that application.

解决方法参考知乎:?MySQL初始化data目录错误问题

总结一下:一定要用管理员的身份打开cmd,再执行mysqld --initialize-insecure指令。

如图所示用管理员的身份打开cmd后窗口上会显示“管理员”字样。

注:如果之前已经以非管理员的形式执行了指令,一定要删除原来的data文件夹,否则会出现如下错误信息:

[ERROR] --initialize specified but the data directory has files in it. Aborting.
posted @ 2018-04-15 11:14  Maxeys  阅读(251)  评论(2编辑  收藏  举报