publicstaticvoidmain(String[]args)throwsClassNotFoundException,SQLException{//SqlliteConnectionconnection=ReadDataForSqlList.createConnection();PreparedStatementstatement...
public static void main(String[] args) throws ClassNotFoundException, SQLException{//SqlliteConnection connection = ReadDataForSqlList.createConnection();PreparedStatement statement = connection.prepareStatement("select title,status,brief,pubtime,updtime,category1,category2,ed2k,content,related from verycd order by verycdid limit ? offset ?");int pageSize = 10000; //每次读取的行数int pageId=0;//每次读取开始的位置boolean isEmpty =true;statement.setInt(1, pageSize);statement.setInt(2, pageId);ResultSet rs =statement.executeQuery();//MysqlConnection con = WriteDataToMysql.createConnection();PreparedStatement prepare = null;int col =0;int num =0;Date day= null; SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); do{if(col==pageSize){ //如果每次读取的行数等于10000则认为数据库中还有数据,则从上次读取结束位置继续读,直至小于10000rs =null;isEmpty =true;col=0;pageId=pageId+pageSize;statement.setInt(1, pageSize);statement.setInt(2, pageId);rs =statement.executeQuery();}else if(col!=pageSize&&pageId!=0&&!rs.next()){isEmpty = true;}else if(col>0&&col
抱歉,代码格式有问题,重新贴了图片
展开