JDBC操作数据库(二) —— 查询操作
数据库查询的普通方法 public static void main(String[] args) {
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try {
//1.加载驱动
Class.forName("com.mysql.jdbc.Driver");
//2.建立连接
connection = DriverManager.
JDBC操作数据库(三) ——抽取工具类
JDBC工具类抽取 1.直接把查询和修改的方法放入工具类中 2.把查询和修改的方法中重复的代码也抽取成方法 3.抽取的另一种方法 *这种方法需要注意 4.SQL注入 5.完善DBUtil工具类(防止SQL注入 ) 总结 前面已经使用JDBC把查询和修改数据库代码抽取出来方法,同样这里我们可以抽取出一个工具类DBUtil 1.直接把查询和修改的方法放入工具类中 public class DBUtil {
public static void query(String sql,IRowMapp
MySQL数据库——外键约束
文章目录 方案一:单张表 方案二:两张表 方案三:两张表并添加外键约束 把用户信息及其收货地址保存在数据中 方案一:单张表 创建表 create table user_info(
id char(36) primary key,
user_name varchar(30) not null,
password varchar(30) not null,
real_name varchar(8),
mobile char(11),
address varchar(150)
[LeetCode] Decoded String at Index 在位置坐标处解码字符串
An encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character at a time and the following steps are taken: If the character read is a letter, that letter is written onto the tape. If the chara
Comparison and usages among Statement, PreparedStatement, CallableStatement
Interfaces Recommended Use Statement Use this for general-purpose access to your database. Useful when you are using static SQL statements at runtime. The Statement interface cannot accept parameters. PreparedStatement Use this when you plan to use
网络编程之TCP编程案例
需求:请上传张图片到服务器。 客户端: public static void main(String[] args) {
System.out.println("客户端启动。。。");
try {
Socket socket=new Socket("127.0.0.1",8000);
File file=new File("d:\\sxt2019\\danta.jpg");
FileInputStream fileInputStrea
一篇了解大数据架构及Hadoop生态圈
一篇了解大数据架构及Hadoop生态圈 阅读建议,有一定基础的阅读顺序为1,2,3,4节,没有基础的阅读顺序为2,3,4,1节。 第一节 集群规划 大数据集群规划(以CDH集群为例),参考链接: https://www.cloudera.com/documentation/enterprise/latest/topics/cm_ig_host_allocations.html https://blog.csdn.net/xuefenxi/article/details/81563033 Clo
Python,mac下如何安装pip、ipython
https://www.jianshu.com/p/746fe7145b99 安装环境: Mac系统版本:OS X 10.11.1 Python版本 3.7 首先安装pip: 1.打开终端: 2.运行脚本:curl https://bootstrap.pypa.io/get-pip.py | python3 3.输入password 成功!!! 安装ipython的脚本 sudo pip install ipython 安装 Numpy(数值计算扩展)的脚本 pip install numpy
Maven----模块化开发
概述: 我们可以将模块划分为如下形式: 统一的依赖管理(dependencies) 通用的工具类(commons) 领域模型(domain) 管理后台(admin) 商城前端(ui) 接口模块(api) pom.xml 文件如下 注意:<packaging>pom</packaging> 管理模块,主要作用是管理整个工程的全部模块(管理每一个项目),当有新模块加入时需要在 modules 元素下配置对应的模块目录 <?xml version="1.0" encoding="UTF-8"?>
8、集合--LinkedList的测试以及相关方法的源码分析
LinkedList测试 public static void main(String[] args) {
List list = new LinkedList();
//添加元素
list.add(1);
list.add(2);
//在指定位置添加元素
list.add(0,0);
System.out.println("list中的元素:" + l
CSS-3D动画笔记
3D 在2d的基础上添加 z 轴的变化 3D 位移:在2d的基础上添加 translateZ(),或者使用translate3d() translateZ():以方框中心为原点,变大 3D 缩放:在2d的基础上添加 scaleZ(),或者使用scale3d() scaleZ()和 scale3d()函数单独使用时没有任何效果 3D 透视:perspective 规定3D元素的透视效果 可以取值为none或不设置,这种情况下说明没有透视效果 取值越小,3d效果越明显 3D背面可见
mysql数据库锁的机制
锁概念 : 当高并发访问同一个资源时,可能会导致数据不一致,需要一种机制将用户访问数据的顺序进行规范化,以保证数据库数据的一致性。锁就是其中的一种机制。 举例 :以买火车票为例,火车票可面向广大消费者,每位用户都可以查询余票数量、购买火车票 ... 但最终购票成功的仅有一位用户,处于购票高峰期时会出现很多用户同时抢夺同一张票的现状,为了避免出现一张火车票被多个用户购买成功的情况,当第一位用户进入购票流程时,就将数据库锁定,让别的用户无法修改,只有当第一位用户购票成功或取消购票之后,才会解除数据
css中background和 background-color 同时使用的优先级
给背景图片设置一个默认背景颜色,有以下两种方法: <style>
.bg1{
background:url(http://debug.itxst.com/img/logo.png) red no-repeat;
height:80px;width:1000%;
}
.bg2{
background:url(http://debug.itxst.com/img/logo.png) no-repeat;
height:80px;wi
Data truncation: Out of range value for column 'quanity' at row 问题解决方案
由于之前在自己电脑上搭建了mysql 5.6的数据库,但是在服务器上搭建的是mysql 5.7的环境,在运行过程中出现了如下错误: Data truncation: Out of range value for column 'quanity' at row 1. 解决问题 问题索源 由于安装的时候没有将STRICT_TRANS_TABLES关闭导致的 排查问题 show variables like "sql_mode";
发现其中有STRICT_TRANS_TABLES 解决问题 将该字
今天,我想写一篇《谈失败》...
谈失败 “ 我觉得人生中最容易的事情就是失败了,啥都不需要做你就会失败,做而不得更是失败,失败的次数多了,便思考是否是自己太过高估自己,但不管是高估或者低估,失败依旧是失败,失败并不会随着你的谦虚或者骄傲的态度而改变,它只会影响你的内心,让你心灰意冷,所谓期望越大,失望越大正是如此。其实在心灰意冷之前你可以试想一下,假设你成功了,是否真的就能高枕无忧,亦或者真的得到可以一劳永逸,其实你心里应该明白,你所谓的失败或成功只是对于某个目标是否完成或达到某种预期的结果。 失败只是你客观能力的一种体现,
今日推荐
周排行