public static void main(String[] args) {
String jhlsh = null;
String jhlsh2 = null;
int id = 0;
int num;
try {
Connection con = Util.getConnection();
Statement stmt = con.createStatement();
ResultSet res = stmt
.executeQuery("select jhlsh from test_id where yljg= '00000001'");
while (res.next()) {
jhlsh = res.getString("jhlsh");
}
id = Integer.parseInt(jhlsh) + 1;
jhlsh2 = id + "";
switch (jhlsh2.length()) {
case 1:
jhlsh2 = "000" + jhlsh2;
break;
case 2:
jhlsh2 = "00" + jhlsh2;
break;
case 3:
jhlsh2 = "0" + jhlsh2;
break;
case 4:
jhlsh2 = jhlsh2;
break;
}
int i = stmt.executeUpdate("update test_id set jhlsh ='" + jhlsh2
+ "' where yljg = '00000001'");
res.close();
stmt.close();
con.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Calendar calendar = Calendar.getInstance();
SimpleDateFormat smp = new SimpleDateFormat("yyyyMMdd");
Date d = calendar.getTime();
try {
Runtime.getRuntime().exec(
"exp zjhit/zjhit@DRG file=d://daochu00000001" + jhlsh2
+ smp.format(d) + ".dmp tables=(ACE_MEDLIST)");
} catch (IOException e1) {
e1.printStackTrace();
}
File f = new File("d:/daochu00000001" + jhlsh2 + smp.format(d) + ".dmp");
while (!f.exists()) {
System.out.println("无文件");
}
String rarPath = "C:\\Program Files\\WinRAR\\WinRAR.exe";
String cmd = "";
String zipfile;
String foler;
zipfile = "d:/daochu00000001" + jhlsh2 + smp.format(d) + ".zip";
foler = "d:/daochu00000001" + jhlsh2 + smp.format(d) + ".dmp";
cmd = rarPath + " m -hp123456 " + zipfile + " " + foler;
System.out.println(cmd);
try {
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }我现在运行这段代码的时,出现一个错误。
! d:\daochu00000001007120091111.zip: 无法打开 daochu00000001007120091111.dmp
! 另一个程序正在使用此文件,进程无法访问。
是怎么回事啊?
高手帮忙解决一下……
解决方案 »
- [高分求助]请问JPA中使用UUID可以用作复合主键吗?
- Hibernate中 外键参照的只能是另一表的主键吗?
- 这个方法JOptionPane.showMessageDialog()为什么弹出来的提示框在页面的下方
- 如何获取多条记录的值?
- java怎么引入下载的包 如SNMP4J包
- Struts2 对指定项目进行验证
- hibernate插入数据库时自增id值为null,新产生一个VO往数据库insert写入时,这个VO的id值总是为null,怎么样在它写入数据库后,取出表中的id
- JDBC3.0问题 是高手就进来看看
- 我在Spring中配置Hibernate的DAO类。
- 对于“对象”和“对象引用”的一点疑惑!你懂你就说点!~不懂也进来看看!~
- spring动态选择数据库,怎么做比较好?
- myeclipse 6.5 Oracle 10g tomcate 5.5 环境下 在debug模式下可正常通过,但在正常环境下运行出错
点那个,看看你这个PG是不是启动过几次了。
估计你是启动多次了,上一次还没关,这次有启动了。
"exp zjhit/zjhit@DRG file=d://daochu00000001" + jhlsh2
+ smp.format(d) + ".dmp tables=(ACE_MEDLIST)");
; 2.File f = new File("d:/daochu00000001" + jhlsh2 + smp.format(d) + ".dmp");
3.Runtime.getRuntime().exec(cmd);
都在使用dmp文件,1文件使用完后没有关闭,所以造成2,3使用的时候冲突