
数据库
文章平均质量分 58
iteye_11997
这个作者很懒,什么都没留下…
展开
-
oracle
create user lisi identified by lisigrant create session to lisi //登陆会话权限grant create table to lisigrant unlimited tablespace to lisi 使用空间的权限select * from user_sys_privs //当前用户拥有的权限 select...2009-12-11 16:40:36 · 86 阅读 · 0 评论 -
mysql DATE 转换 ip to int
where (DATE(b.DATE)='2010-04-28' ) || b.DATE between '2010-04-28' and '2010-04-29' INET_ATON(expr)给出一个作为字符串的网络地址的"点地址"(如127.0....2010-04-28 16:09:40 · 145 阅读 · 0 评论 -
转 mysql insert的几点操作(DELAYED 、IGNORE、ON DUPLICATE KEY UPDATE )
mysql insert的几点操作(DELAYED 、IGNORE、ON DUPLICATE KEY UPDATE ) INSERT语法INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name [(col_nam...原创 2010-05-12 15:55:18 · 343 阅读 · 0 评论 -
mysql insert into select ON DUPLICATE KEY UPDATE 更新值的问题
我有一句话要达到INSERT INTO table1 (count)select count(b.c1) count from table2 b where date(b.date) =... group by b.page_hashON DUPLICATE KEY UPDATE count=count+b.count ON DUPLICA...原创 2010-05-12 20:55:38 · 3705 阅读 · 0 评论 -
mysql 备份 还原 相关
btw, phpmyadmin也可以方便的导出数据结构在网上下了一个java编程的例子想看看,有数据库和源码, 自带使用说明对数据库描述是这样的 mysql -u root -p databasename<microerp-mysql .sql 导入表结构及数据 mysql 数据备份与还原命令: 备份:mysqldump -u root -p dbcurr>...原创 2010-05-14 20:15:00 · 90 阅读 · 0 评论 -
mysql convert binary
select coalesce(p.uuid,convert( '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',BINARY)), date(bc.date) d, count(bc.id) from http://www.geeksengine.com/database/single-row-functions/conversion-funct...原创 2010-11-16 14:16:09 · 202 阅读 · 0 评论 -
转:mysql show processlist命令 详解
processlist命令的输出结果显示了有哪些线程在运行,可以帮助识别出有问题的查询语句,两种方式使用这个命令。1. 进入mysql/bin目录下输入mysqladmin processlist;2. 启动mysql,输入show processlist...原创 2010-12-07 11:05:21 · 369 阅读 · 0 评论 -
mysql master slave 笔记
//dump出整个数据库包含函数定义 可用于master slavemysqldump --master-data=2 -R test > dumpfile_with-R mysql master 192.168.1.101mysql slave 192.168.1.102 首先保证互相能访问登录在mysql>里输入GRANT ALL PRI...原创 2010-06-04 14:36:51 · 116 阅读 · 0 评论 -
mysql 不区分大小写查询 linux 修改 root 密码
vi /etc/mysql/my.cnf 在[mysqld]中添加 lower_case_table_names=1 /etc/init.d/mysql restart grant all privileges on *.* to root@'%' identified by "root";...原创 2010-07-06 19:42:59 · 97 阅读 · 0 评论 -
mysql innodb 主键
http://blog.johnjosephbachir.org/2006/10/22/everything-you-need-to-know-about-designing-mysql-innodb-primary-keys/The primary key determines the order in which the data is physically stored in th...原创 2010-08-12 10:56:43 · 243 阅读 · 0 评论 -
mysql distinct
mysql的DISTINCT的关键字有很多你想不到的用处1.在count 不重复的记录的时候能用到比如SELECT COUNT( DISTINCT id ) FROM tablename;就是计算talbebname表中id不同的记录有多少条2,在需要返回记录不同的id的具体值的时候可以用比如SELECT DISTINCT id FROM tablename;返回tal...原创 2011-04-01 19:13:52 · 249 阅读 · 0 评论 -
(转)mysql 列转行
mysql 的group_concat函数很好用,可以把列转成行。SELECT threadid, group_concat(postid separator ',') as postids FROM msg_reply where group by threadid 输出threadid postids---------------------1 ...原创 2011-04-01 19:14:42 · 213 阅读 · 0 评论 -
mysql 一对多的时候 关联查询 筛选多方
users 表和 auth_token_log表是一对多, 现在是把user的信息找出来 关联上一些auth_token_log表的数据, 因为a表是多的一方,要多他的数据进行一些条件匹配 这个sql目的是查出每个用户的最新的log记录 原始写法 SELECT users.first_name, users.email_address, ...2011-05-10 12:26:17 · 615 阅读 · 0 评论 -
连接池exception GetConnectionTimeoutException get/close not same thread
环境hibernate 4.2.0.Finalspring 3.2.0.RELEASEdruid 1.0.2 异常信息Caused by: org.hibernate.exception.GenericJDBCException: Could not open connectionCaused by: com.alibaba.druid.pool.GetConnec...2015-09-24 14:44:59 · 942 阅读 · 0 评论 -
update select , coalesce(被查字段,默认值)
update a,bset a.name=b.name where a.id=b.id coalesce(被查字段,默认值) null 时用 select Id,coalesce(num,0) as num from aaa2010-04-22 21:13:08 · 335 阅读 · 0 评论 -
hibernate 查询 set
List unitFuncs = session.createQuery( "select model.unitFuncs from JbComSysuniinfo as model where model.uniId = '" + UniId + "'").list();2009-09-24 20:15:27 · 120 阅读 · 0 评论 -
sql 注入
sql injection password :'or '1'='1 RunTimeException 不用throws public User login(String userId,String password){ User user=findUserById(userId); if(user==null){ throw new UserNotFoundExcept...2009-12-11 16:54:12 · 80 阅读 · 0 评论 -
JDBC 数据库批量操作
try { Connection conn = ConnectionManager.getConnection(); pstmt = conn.prepareStatement(sql); for (Iterator iter=flowCardDetailList.iterator(); iter.hasNext();) { FlowCardDetail flo...2009-12-11 17:03:16 · 116 阅读 · 0 评论 -
mysql
mysql my.ini [mysql] default-character-set=GBK # The default character set that will be used when a new schema or table is # created and no character set is defined default-cha...2009-12-11 17:21:57 · 95 阅读 · 0 评论 -
Proxool 0.9.1 笔记
web.xml中<servlet> <servlet-name>ServletConfigurator</servlet-name> <servlet-class> org.logicalcobwebs.proxool.configuration.ServletConfig...2009-06-22 18:29:06 · 105 阅读 · 0 评论 -
sql 查询
SELECT A.username, SUM(CASE WHEN B.flag = 'colA' THEN 1 ELSE 0 END) AS count_A, SUM(CASE WHEN B.flag = 'colB' THEN 1 ELSE 0 END) AS count_B, SUM(CASE WHEN B.flag = 'colC' THEN 1 EL...原创 2009-07-08 19:01:50 · 81 阅读 · 0 评论 -
sql 顺序
标准的 SQL 的解析顺序为: (1).FROM 子句, 组装来自不同数据源的数据 (2).WHERE 子句, 基于指定的条件对记录进行筛选 (3).GROUP BY 子句, 将数据划分为多个分组 (4).使用聚合函数进行计算 (5).使用 HAVING 子句筛选分组 (6).计算所有的表达式 (7).使用 ORDER BY 对结果集进行排序...原创 2009-07-10 15:08:04 · 175 阅读 · 0 评论 -
删除mysql/data中的bin文件
装mysql,运行一段时间后,在mysql目录下出现一堆类似 mysql-bin.000***,从mysql-bin.000001开始一直排列下来,而且占用了大量硬盘空间,高达几十个G. 对于这些超大空间 占用量的文件我们应该怎么办呢? 我的数据库加起来大概100M吧..但/usr/local/mysql/var这个目录竟然有548M,MySql-bin.000...原创 2010-09-01 15:42:25 · 898 阅读 · 0 评论 -
mysql primary key PARTITION 分区
尝试把数据库一个表分区 ALTER TABLE user PARTITION BY RANGE(TO_DAYS(`date`)) (PARTITION p1004 VALUES LESS THAN (TO_DAYS('2010-5-1')),PARTITION p1005 VALUES LESS THAN (TO_DAYS('2010-6-1')),PARTITION p...原创 2010-09-02 14:45:53 · 283 阅读 · 0 评论 -
创建MySQL用户 赋予某指定库表的权限
updateERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value建议使用GRANT语句进行授权,语句如下:grant all privileges on *.* to root@'%' identified by "root"; ---------------------------...原创 2010-09-15 13:58:11 · 1030 阅读 · 0 评论 -
hinernate identity
今天用设主键生成策略的时候选择identity ,结果老是说我插入null后来调了一下,才明白 那个表之前是我先在数据库生成好的,创建的时候并没有指定主键自增长,所以 设定这个identity 是需要数据库那边配合的,或者在hbm.xml中设置好后让hibernate帮你创建数据库表...2009-08-26 14:59:54 · 99 阅读 · 0 评论 -
jtds issue
Description: Opened: 2004-11-02 12:07 I have PAL Itn6, snapshot of ~12:00 yesterday installed in Tomcat 5.0.28talkingto SQL server via a JNDI data-source and the JNDI drivernet.sourcef...原创 2009-09-17 11:05:53 · 115 阅读 · 0 评论 -
sqlserver jdbc driver issue
com.microsoft.jdbc.sqlserver.SQLServerDriverjdbc:microsoft:sqlserver://127.0.0.1:1433 图像存储 unsupported data conversion问题。原因如下:microsoft SQL驱动默认支持Blob(图像)及Clob(大型文本数据)的存储,却不能读取,发现需要替换为Microsof...原创 2009-09-17 14:00:49 · 84 阅读 · 0 评论 -
hibernate sqlserver 保留字
今天配一个系统 原来在mysql上正常的 现在配到sqlserver上 hibernate 应该是很方便才对 结果出了个错 搞了半天 原因是user是sqlserver的保留字 不能做列名 kuso啊 ...2009-09-17 16:14:44 · 133 阅读 · 0 评论 -
业务unique ID的生成策略分析
业务unique ID的生产策略分析 需求上下文: 业务是和单个user相关的(userId),业务表分到10个DB host中 需求: 高并发下生产唯一的业务ID 首先根据此用户的userId mapping到不同的DB host(oracle), 每个DB host上有一个业务seq, 这个seq自增步长是10,然后每个h...2017-02-20 16:31:01 · 256 阅读 · 0 评论