一.拦截SQL

  • 1.slow log
  • 2.general log
  • 3.mycat sql拦截器

二.mycat sql拦截器

  • 1.配置server.xml
# 1.5可用
<system>
<property name="sqlInterceptor">org.opencloudb.interceptor.impl.StatisticsSqlInterceptor</property>
<property name="sqlInterceptorType">UPDATE,DELETE,INSERT,SELECT</property>
<property name="sqlInterceptorFile">/tmp/sql.txt</property>
</system> # 1.6可用
<system>
<property name="sqlInterceptor">io.mycat.server.interceptor.impl.StatisticsSqlInterceptor</property>
<!-- 1.6 io.mycat.server.interceptor.impl.StatisticsSqlInterceptor -->
<property name="sqlInterceptorType">UPDATE,DELETE,INSERT,SELECT</property>
<property name="sqlInterceptorFile">/tmp/sql.txt</property>
</system>
  • 2.测试
# mycat restart
app_imooc@172.16.10.142 15:39: [imooc_db]> select order_sn,order_id,customer_id from order_master limit 1;
+----------+----------+-------------+
| order_sn | order_id | customer_id |
+----------+----------+-------------+
| 70005 | 5 | 90005 |
+----------+----------+-------------+
1 row in set (0.01 sec) app_imooc@172.16.10.142 15:40: [imooc_db]> delete from order_master where order_id=5;
Query OK, 1 row affected (0.03 sec)
  • 3.文件名会带日期
sql2018-08-05.txt

SQL拦截器的更多相关文章

  1. Mybatis自定义SQL拦截器

    本博客介绍的是继承Mybatis提供的Interface接口,自定义拦截器,然后将项目中的sql拦截一下,打印到控制台. 先自定义一个拦截器 package com.muses.taoshop.com ...

  2. mybatis:SQL拦截器

    打印执行的SQL语句 import java.sql.Connection; import java.text.DateFormat; import java.util.Date; import ja ...

  3. EntityFramework6.0的Sql读写分离拦截器 和 MVC的 Action拦截器 对比

    EF的DbCommandInterceptor类 拦截: EF6.1也出来不少日子了,6.1相比6.0有个很大的特点就是新增了System.Data.Entity.Infrastructure.Int ...

  4. SpringMVC利用拦截器防止SQL注入

    引言 随着互联网的发展,人们在享受互联网带来的便捷的服务的时候,也面临着个人的隐私泄漏的问题.小到一个拥有用户系统的小型论坛,大到各个大型的银行机构,互联网安全问题都显得格外重要.而这些网站的背后,则 ...

  5. Mybatis拦截器实现SQL性能监控

    Mybatis拦截器只能拦截四类对象,分别为:Executor.ParameterHandler.StatementHandler.ResultSetHandler,而SQL数据库的操作都是从Exec ...

  6. MyBatis拦截器打印不带问号的完整sql语句方法

    /* Preparing: SELECT * FROM tb_user WHERE id = ? AND user_name = ?  目标是打印:SELECT * FROM tb_user WHER ...

  7. Spring MVC通过拦截器处理sql注入、跨站XSS攻击风险

    sql注入就是通过url或者post提交数据时候,字符串类型的参数会被别人利用传入sql语句,最终破坏数据库或者达到一些见不得人的目的. 有时候因为业务需要url中会带一些参数,比如 ?type=xx ...

  8. mybatis - 基于拦截器修改执行中的SQL语句

    拦截器介绍 mybatis提供了@Intercepts注解允许开发者对mybatis的执行器Executor进行拦截. Executor接口方法主要有update.query.commit.rollb ...

  9. EF Core3.0+ 通过拦截器实现读写分离与SQL日志记录

    前言 本文主要是讲解EF Core3.0+ 通过拦截器实现读写分离与SQL日志记录 注意拦截器只有EF Core3.0+ 支持,2.1请考虑上下文工厂的形式实现. 说点题外话.. 一晃又大半年没更新技 ...

随机推荐

  1. Windows 计划任务 如果选择未登录就运行 则看不到GUI

    You can specify that a task should run even if the account under which the task is scheduled to run ...

  2. Windows挂载Gluster复制卷

    本地挂载测试 mount -t glusterfs 127.0.0.1:/gv1 /mnt [root@gluster1 mnt]# df -h Filesystem Size Used Avail ...

  3. 在 ubuntu20 上替换原有的源,解决下载软件慢的问题

    处理方式 使用命令查看到所有的下载源 sudo gedit /etc/apt/sources.list 使用163的源替换掉原始的源 163:http://mirrors.163.com/ubuntu ...

  4. Spring Boot JPA 中transaction的使用

    文章目录 @Transactional的实现 @Transactional的使用 Transaction的传播级别 REQUIRED SUPPORTS MANDATORY NEVER NOT_SUPP ...

  5. Ubuntu下访问Windows中Postgresql

    因为项目的原因,需要将Ubuntu中的一些信息记录到Windows中的Postgresql数据库中,查看网上信息,最后成功了,特地记录以下,需要以下步骤: (1)在Windows中Postgresql ...

  6. React技术栈——Redux

    Redux 1.Redux是什么?   Redux对于JavaScript应用而言是一个可预测状态的容器.换言之,它是一个应用数据流框架,而不是传统的像underscore.js或者AngularJs ...

  7. CreateDIBSection和位图结构

    2019独角兽企业重金招聘Python工程师标准>>> 理解分辨率 我们常说的屏幕分辨率为640×480,刷新频率为70Hz,意思是说每行要扫描640个象素,一共有480行,每秒重复 ...

  8. 爱创课堂每日一题第五十四天- 列举IE 与其他浏览器不一样的特性?

    IE支持currentStyle,FIrefox使用getComputStyle IE 使用innerText,Firefox使用textContent 滤镜方面:IE:filter:alpha(op ...

  9. Codeforces Round #460 (Div. 2)-A Supermaket(贪心)

    A. Supermarket time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  10. Codeforce1311B. WeirdSort (冒泡排序)

    You are given an array a of length n. You are also given a set of distinct positions p1,p2,-,pm, whe ...