免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2410 | 回复: 1
打印 上一主题 下一主题

autocommit以及系统安全性 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-10-15 14:32 |只看该作者 |倒序浏览
,版本问题吧。装个新的版本就可以了。
我的 mysql  Ver 14.14 Distrib 5.1.41

mysql> show  variables like 'autocommit';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| autocommit    | ON    |
+---------------+-------+
1 row in set (0.00 sec)



mysql> select @@autocommit;
+--------------+
| @@autocommit |
+--------------+
|            1 |
+--------------+
1 row in set (0.00 sec)
phphp 发表于 2010-06-22 17:34

5.0没有导出autocommit到show variables列表中, 只能通过select @@autocommit来看。
kissjiejie

问题 我准备在java 环境下大量使用  prepared statements  (linux java mysql 环境)
1而当前的环境是autocommit=1,  是否有必要我把 mysql 的my.cnf 配置修改 为 autocommit=0??
在java 环境下大量使用  prepared statements 是否mysql 需要做特别的配置?
2  我的当前应用复杂,全部是update delete insert 更新语句
请问到底 用prepared statements还是 statement语句好

论坛徽章:
0
2 [报告]
发表于 2010-10-15 16:46 |只看该作者
是否我应该把这2个参数 都加入到my.cnf里
cachePrepStmts=true
useServerPrepStmts=true
(很头疼 )

参考
1而当前的环境是autocommit=1, 是否有必要我把 mysql 的my.cnf 配置修改 为 autocommit=0??

你的表是什么? 如果是MYSAIM则改不改都无所谓。
如果是INNODB的,则根据你是否需要事务而定。
------------全部 innodb 。 用事务很少。但用到。

自己的探索:

Using Server-Side Prepared Statements
• “useServerPrepStmts=true”---------------看官方手册 提示要在 my.cnf 这个加这个好
• Less parsing - “native” on-wire format
• Binding and Execution have compact on-wire format
• Sketchy on early versions of MySQL-5.0
• Type conversions can be more costly
• Less memory pressure

官方还提到
Caching Prepared Statements
• “cachePrepStmts=true”
• “prepStmtCacheSize=..” and “prepStmtCacheSqlLimit=...”
• Saves parsing cost (even more in version 5.1.
• Reduces memory footprint for non-server-side statements
• Reduces latency for server-side statements
prepareStatement() phase

新问题
1 是否我应该把这2个参数 都加入到my.cnf里?
2 如何看当前的系统的这2个参数状态 ?
mysql> show VARIABLES like '%cachePrepStmts%';
Empty set
mysql> show VARIABLES like '%userServerPrepStmts%';
Empty set


查看代码 ,发现开发人员用的是
jdbc.Driver"; Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/mydb" +
  "?cachePrepStmts=true", "user", "pass";
f都加了cachePrepStmts=true的 ------都是在java里加的
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP