08 2013 档案

java多线程什么时候释放锁—wait()、notify()
摘要:由于等待一个锁定线程只有在获得这把锁之后,才能恢复运行,所以让持有锁的线程在不需要锁的时候及时释放锁是很重要的。在以下情况下,持有锁的线程会释放锁: 1. 执行完同步代码块。 2. 在执行同步代码块的过程中,遇到异常而导致线程终止。 3. 在执行同步代码块的过程中,执行了锁所属对象的wait()方法,这个线程会释放锁,进行对象的等待池。 除了以上情况外,只要持有锁的此案吃还没有执行完同步代码块,就不会释放锁。因此在以下情况下,线程不会释放锁: 1. 在执行同步代码块的过程中,执行了Thread.sleep()方法,当前线程放弃CPU,开始睡眠,在睡眠中不会释放锁。 2. 在执行同步代码块的过. 阅读全文

posted @ 2013-08-13 18:14 世界之大追梦者 阅读(12292) 评论(1) 推荐(1)

sql中NULL的问题
摘要:sql中NULL的问题今天一不小心在sql中写出以下脚本select defaultPositionId from TableName where UserId=1100528 and defaultPositionId =null执行之后大惊怎么没有结果,使用select * from tableName 该列确实为null怎么查补出来难道自己人品问题于是自己又写了以下判断if(null=null)BEgin print 'fff'endelsebegin print 'gggg'end www.2cto.com 输出结果如下:无语难道null与null还有区 阅读全文

posted @ 2013-08-12 09:16 世界之大追梦者 阅读(318) 评论(0) 推荐(0)

oracle的nvl和sql server的isnull函数
摘要:最近公司在做Oracle数据库相关产品,在这里作以小结:ISNULL()函数语法 ISNULL ( check_expression , replacement_value)参数 check_expression 将被检查是否为 NULL的表达式。check_expression 可以是任何类型的。 replacement_value 在 check_expression 为 NULL时将返回的表达式。replacement_value 必须与 check_expresssion 具有相同的类型。 返回类型 返回与 check_expression 相同的类型... 阅读全文

posted @ 2013-08-12 08:56 世界之大追梦者 阅读(1362) 评论(0) 推荐(0)

曾经不会的
摘要:1、从一张表中查询出,相同id的数据的所有信息select * from 表 where id in(select id from 表 group by id having count(*)>1);2、从一张表中删除,code重复的数据deletefrom area a where a.id>(select min(id) from area b where a.code=b.code );3、从一张表中查询出,去掉code重复的数据select * from area a where a.id in (select min(id) from area b where a.code 阅读全文

posted @ 2013-08-09 14:57 世界之大追梦者 阅读(143) 评论(0) 推荐(0)

Oracle数据库之间数据同步
摘要:这段时间负责某个项目开发的数据库管理工作,这个项目中开发库与测试数据库分离,其中某些系统表数据与基础资料数据经常需要进行同步,为方便完成指定数据表的同步操作,可以采用dblink与merge结合的方法完成,简单方便。操作环境: 此Oracle数据库服务器ip为192.168.196.76,有center与branch两个库,一般需要将center的表数据同步到branch,center为源库,branch为目标库,具体步骤如下:1.在源库创建到目标库的dblinkcreate database link branch --输入所要创建dblink的名称,自定义connect to dbuser 阅读全文

posted @ 2013-08-08 08:47 世界之大追梦者 阅读(422) 评论(0) 推荐(0)

XML为数据库进行增删改查(实例)
摘要://增删改查文件package xml2;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.io.UnsupportedEncodingExceptio 阅读全文

posted @ 2013-08-06 18:04 世界之大追梦者 阅读(457) 评论(0) 推荐(0)

java使用dom4j和XPath解析XML与.net 操作XML小结
摘要:最近研究java的dom4j包,使用 dom4j包来操作了xml 文件包括三个文件:studentInfo.xml(待解析的xml文件), Dom4jReadExmple.java(解析的主要类), TestDom4jReadExmple.java(测试解析的结果)studentInfo.xml 崔卫兵 PC学院 62354666 男,1982年生,硕士,现就读于北京邮电大学 cwb PC学院 62358888 男,1987年生,硕士,现就读于中国农业大学 xxxxx xxx学院 66666666 注视中,注释中 lxx yyyy学院 88888888 注视中111,注释中22... 阅读全文

posted @ 2013-08-06 13:59 世界之大追梦者 阅读(300) 评论(0) 推荐(0)

java直接打开pdf,doc,xls
摘要:jsp页面:Js代码 在线打开 html页面超链接单击打开online函数Js代码 varonLine=function(filename){ varparam="toolbar=yes,location=yes,menubar=yes, scrollbars=yes,resizable=yes"; varpath="DocumentCabinetAction!openOnLine.action? filepath="+encodeURI(filename); window.open(path,'maxwindow',param); }; 阅读全文

posted @ 2013-08-05 17:19 世界之大追梦者 阅读(1218) 评论(0) 推荐(0)

java中的File.separator
摘要:前些天遇到一个问题,困扰了好久,现在终于解决了。问题:上传的图片不能正确显示。我的开发环境是在Windows下,工程在Windows下能正常部署,上传的图片也可以正常的显示。但是把工程部署在服务器上的时候,图片总是不能显示,很是让人郁闷,后来在网上找了各种资料,问题终于解决了。文件路径的分隔符在windows系统和linux系统中是不一样。比如说要在temp目录下建立一个test.txt文件,在Windows下应该这么写:File file1 = new File (“C:\tmp\test.txt”);在Linux下则是这样的:File file2 = new File (“/tmp/tes 阅读全文

posted @ 2013-08-05 13:43 世界之大追梦者 阅读(326) 评论(0) 推荐(0)

TRIGGERS_监测系统_多表视图触发器—向原始数据报表中插入数据
摘要:Create Or Replace Trigger trg_view_report Instead Of Insert or update or delete on view_for_report for each rowDeclarebegin If Inserting Then if :new.temperature1 <= 250 then insert into originaldata_report (id, wid, wname, jurisdiction, jurisdiction_name, year, month, day, temperature, humidity) 阅读全文

posted @ 2013-08-02 18:12 世界之大追梦者 阅读(276) 评论(0) 推荐(0)

PROCEDURE_监测系统_原始数据报表数据生成存储过程—求每天平均值插入多表视图
摘要:create or replace procedure proc_generate_report(in_date in varchar2) is v_retCode varchar2(20); v_retMsg varchar2(500);begin v_retCode:= ''; v_retMsg:= ''; insert into view_for_report select t.id, max(w.wid) wid, max(w.wname) wname, substr(max(t.time), 1, 4) year, substr(max(t.time) 阅读全文

posted @ 2013-08-02 18:09 世界之大追梦者 阅读(208) 评论(0) 推荐(0)

PROCEDURE_监测系统_数据备份存储过程—备份原始数据,每十分钟一条,取平均值
摘要:create or replace procedure proc_backup_originaldata(retCode out varchar2, -- 返回码 retMsg out varchar2) --返回信息isv_now varchar2(20):=to_char(sysdate,'yyyy-mm-dd');cursor c_backup is select * from originaldata t where t.time <=v_now;v_filename varchar2(50):=v_now||'.txt';v_datastr va 阅读全文

posted @ 2013-08-02 18:04 世界之大追梦者 阅读(264) 评论(0) 推荐(0)

TRIGGERS_监测系统_原始数据表触发器—调用告警信息存储过程
摘要://每次向originaldata表中插入数据就会触发该触发器create or replace trigger originaldata_to_alarm after insert on originaldata for each rowdeclare v_temperature num_array := num_array(1, 0); v_humidity num_array := num_array(1, 0); v_concentration num_array := num_array(1, 0);begin v_temperature.extend(10); v_humidity 阅读全文

posted @ 2013-08-02 17:53 世界之大追梦者 阅读(161) 评论(0) 推荐(0)

PROCEDURE_监测系统_告警信息存储过程—产生告警信息插入告警表
摘要:create or replace procedure proc_alarmlog(in_id in number, --采集器编码 ip_code in number, --采集器ip in_time varchar2, --采集时间 t_arr num_array, --温度数据 h_arr num_array, --湿度数据 c_arr num_array) --二氧化碳数据is min_table num_type := num_type(0); --仓库监控阈值范围最小值 max_table num_type := num_type(0); --仓库监控阈值范围最大值 state_t 阅读全文

posted @ 2013-08-02 17:49 世界之大追梦者 阅读(422) 评论(0) 推荐(0)

导航