ssm整合后打印日志查看执行sql语句
mybatis.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!--打印日志可以看执行的sql语句-->
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
</configuration>
spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <!--第一步,扫描service-->
<context:component-scan base-package="com.guangming.service.impl"></context:component-scan>
<!--第二步,加载jdbc.properties-->
<context:property-placeholder location="classpath:jdbc.properties"></context:property-placeholder>
<!--第三步,创建dbcp数据源连接池-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${driver}"></property>
<property name="url" value="${url}"></property>
<property name="username" value="${user}"></property>
<property name="password" value="${password}"></property>
</bean>
<!--第四步,创建mybatis的工厂类对象-->
<bean class="org.mybatis.spring.SqlSessionFactoryBean">
<!--指定数据源-->
<property name="dataSource" ref="dataSource"></property>
<!--加载mybatis的映射文件 在value中可以使用*号通配符-->
<property name="mapperLocations" value="classpath:com/guangming/dao/*.xml"></property>
<!--加载mybatis中的配置文件-->
<property name="configLocation" value="classpath:mybatis.xml"></property>
</bean>
<!--第五步,在spring 的工厂中生成dao接口的实现类对象 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--指定要扫描哪个包下面所有的dao接口-->
<property name="basePackage" value="com.guangming.dao"></property>
</bean>
<!--第六步,创建spring的事物管理器-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!--第七步,声明以注解的方式配置声明式事物-->
<tx:annotation-driven transaction-manager="transactionManager" ></tx:annotation-driven> </beans>
ssm整合后打印日志查看执行sql语句的更多相关文章
- mysql查看执行sql语句的记录日志
开启日志模式 -- 1.设置 -- SET GLOBAL log_output = 'TABLE';SET GLOBAL general_log = 'ON'; //日志开启 -- SET GLOB ...
- laravel查看执行sql的
加个监听就好了~~~~而且很简单 1.在routes.php(api.php\web.php)中添加如下语句 Event::listen('illuminate.query', function($s ...
- ORA-01843: 无效的月份,执行sql语句更改为美国语言后仍然失败的解决办法
ORA-01843: 无效的月份失败的 sql 为:XXXXXXXXXXXXXXXX 执行sql语句更改为美国语言后仍然失败, ALTER SESSION SET NLS_DATE_LANGUAGE= ...
- [sqlserver脚本]查看指定SQL语句生成了哪些执行计划
参考SQL技术内幕写了一段脚本,可以通过这段脚本查看执行指定SQL语句后,系统生成了哪些执行计划.使用时注意以下几点: 修改use MyTest,换成自己的数据库名字. 将 exec sp_page_ ...
- 解决Mysql搭建成功后执行sql语句报错以及区分大小写问题
刚搭建完mysql 8.0以后会: 一.表区分大小写, 二.执行正确的sql语句成功且会报:[Err] 1055 - Expression #1 of ORDER BY clause is not i ...
- 使用BAT批处理执行sql语句的代码
使用BAT批处理执行sql语句的代码 有时候需要执行一些Sql语句时,不想开企业管理器,或者是发给客户执行但那边又不懂代码,这时就可以用下面方法 1.把待执行Sql保存在一个文件,这里为2011022 ...
- 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据操作(二)
CSSDesk body { background-color: #2574b0; } /*! zybuluo */ article,aside,details,figcaption,figure,f ...
- 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据操作
http://www.cnblogs.com/wgp13x/p/4934521.html 内容一样,样式好的版本. 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据 ...
- [转]在EntityFramework6中执行SQL语句
本文转自:http://www.cnblogs.com/wujingtao/p/5412329.html 在上一节中我介绍了如何使用EF6对数据库实现CRDU以及事务,我们没有写一句SQL就完成了所有 ...
随机推荐
- sublime text3添加并修改编译系统
版权声明:本文为CSDN博主「肥宅_Sean」的原创文章,遵循 CC 4.0 BY-SA 版权协议,原文链接 方法工具 -> 编译系统 -> 新建编译系统 按ctrl+s保存.(注意,这里 ...
- JAVA—SQL注入
之前看到的一道java面试题,Statement与PreparedStatement的区别,什么是SQL注入,如何防止SQL注入 前面部分比较好回答 1.PreparedStatement支持动态设置 ...
- 常见DL网络模型参数
- Q - QQpet exploratory park HDU - 1493 (概率DP)
题目大意: 一共有61个位置,标记为0~60.其中有10个重要位置,分别为:5, 12, 22, 29, 33, 38, 42, 46, 50 and 55. 有一个筛子,一共6个面,标有1~6.摇到 ...
- Catch him 杭电 2531
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2531 题解 :这个题目的坑就是D的个数,一开始天真的一位就2个,不是这样的,D的数目是不定的.所以我们 ...
- ado.net 面向对象
面向对象:就是一个大的转换器,建立起一条通道通往数据库然后通过通道将所需(方法)数据从转换器往返于外部界面端 1 首先在项目里创建文件夹: 右击项目———添加个文件夹App_Cod 2 ...
- tensorflow1.0 矩阵相乘
import tensorflow as tf matrix1 = tf.constant([[3,3]]) matrix2 = tf.constant([[2],[2]]) product = tf ...
- git flow配置问题
Mac使用 git flow 的时候,当 -m 进行换行有时消息会被截断,怎么解决? 原因: brew 上的 gnu-getopt 这个包未配置好 步骤: 1. 在 ~/.gitflow_export ...
- Scrapy中的crawlspider
crawlspider 能自动的获取url并提交请求 命令:scrapy genspider -t crawl spidername 'example.cn' 所导入的模块 # -*- coding: ...
- python学习笔记(四)---用户输入与while循环
用户输入 函数input demo1: message = input("all you input is chars:") print(message) demo2: 由inpu ...