//将数据库中的数据条数分段
public void division(){
//获取要导入的总的数据条数
String sql3="SELECT count(*) FROM [CMD].[dbo].[mycopy1]";
try {
pss=cons.prepareStatement(sql3);
rss=pss.executeQuery();
while(rss.next()){
System.out.println("总记录条数:"+rss.getInt(1));
sum=rss.getInt(1);
}
//每30000条记录作为一个分割点
if(sum>=30000){
n=sum/30000;
residue=sum%30000;
}else{
residue=sum;
}
System.out.println(n+" "+residue);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
得注意锁
~~~~~~~~~~~~~~~~~~