linux下运行报段错误

jy3023126 2006-07-31 10:26:39
package com.wee.util;

//import com.wee.common.ConnPoolHandler;
import com.wee.jsunicom.optstat.Tsttoptstat;
import java.sql.*;

public class Optstat {

public Optstat() {
super();
}

int insertStat(Connection con) {
// Vector vector=null;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "";
int i = 0;
try {
System.out.println("Start");
/*
* sql="select t.operation,count(*),trunc(sysdate-1,'dd') " + "from
* truslog t " + "where t.createdate>=trunc(sysdate-1,'dd') " + "and
* t.createdate<trunc(sysdate,'dd') " + "group by t.operatrion";
*/
sql = "select count(*) from tsttoptstat";
stmt = con.prepareStatement(sql);
rs = stmt.executeQuery();
while (rs.next()) {
/*
* Tsttoptstat tsttoptstat=new Tsttoptstat();
* tsttoptstat.setOptname(rs.getString(1));
* tsttoptstat.setCount(rs.getInt(2));
* tsttoptstat.setCreatedate(rs.getTimestamp(3));
* tsttoptstat.insert(con);
*/
System.out.println(rs.getLong(1));
i++;
}
} catch (Exception e) {
System.out.println(e);
}
return i;
}

public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Optstat optstat = new Optstat();
Connection con = null;
con = // ConnPoolHandler.getConnection();
DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:local",
"jsunicom", "jsunicom");
optstat.insertStat(con);
} catch (Exception e) {System.out.println(e);
} finally {
// ConnPoolHandler.closeConnection(con);
}
}
}
...全文
99 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
凋零的老树 2006-07-31
  • 打赏
  • 举报
回复
什么错?

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧