org.ektorp.DbAccessException:java.net.SocketTimeoutException:读取超时

时间:2015-02-19 00:42:11

标签: java csv timeout couchdb converter

您好我有这个代码并尝试从我的大学服务器上从我的couchdb导出一个视图,该视图有超过150万个文档

公共课主要 {     public static void main(String [] args)抛出MalformedURLException

{
    HttpClient httpclient = new StdHttpClient.Builder().url("http://localhost:5984").socketTimeout(100000).build();

    CouchDbInstance dbInstance = new StdCouchDbInstance(httpclient);
    CouchDbConnector db = new StdCouchDbConnector("twitterdb2",dbInstance);
      ViewQuery query = new ViewQuery().designDocId("_design/retweetzahl").viewName("retweetzahl").group(true); StreamingViewResult data = db.queryForStreamingView(query); try { CSVWriter writer = new CSVWriter(new FileWriter("C:\\Users\\Administrator\\Desktop\\idanzahl.csv"));long counter = 1;String[] read = new String[] {"doc_id","retweetcount"};writer.writeNext(read);writer.flush(); for(Row row : data){
read = new String[] {row.getKey(), row.getValue()};
writer.writeNext(read);
writer.flush();
System.out.println(counter);
counter++; } System.out.println("Fertig ");data.close();writer.close(); }catch(Exception socketTimeoutException){



}
    }

}

但它不起作用,我在线程“main”org.ektorp.DbAccessException中收到有关Exception的消息:java.net.SocketTimeoutException:read timed out

有人可以给我一个建议吗,它在500.000个文件的小型数据库上工作

0 个答案:

没有答案