粗糙的区别prepareStatement:(为Statement的子类)与Statement
区别:
prepareStatement:(为Statement的子类)
conn = DBFactory.getInstance().getImpl().getConnection();
//方式一:(不推荐)
//pstmt = conn.prepareStatement(" update "+tb+" set WDNR=? where "+bh+"=?");
//方式二:
pstmt.setBinaryStream(1, doc.getWDNR(), (int) doc.getStreamSize());
pstmt.setString(2, doc.getWDMC());
returnVal = pstmt.executeUpdate();
______________________________________
Statement:
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
//用于加载Driver类(jdbc驱动器)
//registerDriver注册java.sql.DriverManager.registerDriver
Class.forName("org.mariadb.jdbc.Driver").newInstance();
String url = "jdbc:mariadb://192.168.1.100:3306/test?user=root&password=pdcss";
conn = DriverManager.getConnection(url);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
粗糙的区别prepareStatement:(为Statement的子类)与Statement的更多相关文章
- 【mysql】must reset your password using ALTER USER statement before executing this statement
问题描述: must reset your password using ALTER USER statement before executing this statement 登录centos服务 ...
- You must reset your password using ALTER USER statement before executing this statement.
MySQL 5.7之后,刚初始化的MySQL实例要求先修改密码.否则会报错: mysql> create database test; ERROR 1820 (HY000): You must ...
- 第一次登录mysql,使用任何命令都报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
问题: 使用临时密码登录成功后,使用任何myql命令,例如show databases;都提示下面的报错 ERROR 1820 (HY000): You must reset your passwor ...
- MySQL用户密码过期登陆报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
今天接到主从复制失败告警,查看MySQL,发现MySQL能够登陆但是执行命令报错, ERROR 1820 (HY000): You must reset your password using ALT ...
- MySQL:Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT...
1:错误日志大量错误 150602 14:40:02 [Warning] Unsafe statement written to the binary log using statement form ...
- MySQL root账户密码设为“root”后执行命令提示ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
修改root账户密码为“root”后,提示ERROR 1820 (HY000): You must reset your password using ALTER USER statement bef ...
- MySQL:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决方法: 修改密码:alter user 'root'@'localhost' identified by '123456'; mysql> use mysql; ERROR 1820 (HY ...
- 【mysql】You must reset your password using ALTER USER statement before executing this statement. 报错处理
1.问题:登陆mysql以后,不管运行任何命令,总是提示这个 mysql> select user,authentication from mysql.user; ERROR 1820 (HY0 ...
- MySQL5.7 报错 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement
MySQL5.7 报错 : ERROR 1820 (HY000): You must reset your password using ALTER USER statement before exe ...
随机推荐
- JS高级程序随笔一
function Aarguments(x,y){ for(var i=0;i<arguments.length;i++){ alert(arguments[i]); }; }; Aargume ...
- spring-data-neo4j了解
本项目demo地址[请阅读readme文件]: https://gitee.com/LiuDaiHua/project-neo4j 最近项目上要搭建一个关系图谱的东西,领导给了neo4j和d3两个概念 ...
- ng2-file-upload插件在ionic3中的使用方法
本文主要说明在ionic3中使用ng2-file-upload插件,上传多种类型文件(图片.word.excel.ppt.mp4等)的使用方法. 1.html代码: <button ion-bu ...
- #Ubuntu16.0.4 LTS 安装RabbitMQ
1.ubuntu下安装配置rabbitmq-server服务器环境:ubuntu16.0.4(向下兼容14.0.4)软件版本:RabbitMQ 3.7.5 .Erlang 20.1.7参考文档:htt ...
- java 延时
Java中主要有两种方法来实现延迟,即:Thread和Timer 1.普通延时用Thread.sleep(int)方法,这很简单.它将当前线程挂起指定的毫秒数.如try{Thread.currentT ...
- Es学习第三课, ElasticSearch基本的增删改查
前面两课我们了解了ES的基本概念并且学会了安装ES,这节课我们就来讲讲ES基本的增删改查:ES主要对外界提供的是REST风格的API,我们通过客户端操作ES本质上就是API的调用.在第一课我们就讲了索 ...
- python利用ConfigParser读写配置文件
ConfigParser 是Python自带的模块, 用来读写配置文件, 用法非常简单. 配置文件的格式是: []包含的叫section, section 下有option=value这样的键值 ...
- STM点滴一
就就是你用BSRR和BRR去改变管脚状态的时候,没有被中断打断的风险.也就不需要关闭中断. This way, there is no risk that an IRQ occurs between ...
- jcrop+java 后台
//jcrop 用法 lpf //页面引入 //<link rel="stylesheet" href="${basePath}/scripts/jcrop/jqu ...
- Python每日一题 003
将 002 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中. 代码 import pymysql import uuid def get_id(): for i in ra ...