最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

mysql-Eclipse用JAVA连接Mysql插入大量数据报错Javaheapspace

来源:懂视网 责编:小采 时间:2020-11-09 16:33:16
文档

mysql-Eclipse用JAVA连接Mysql插入大量数据报错Javaheapspace

mysql-Eclipse用JAVA连接Mysql插入大量数据报错Javaheapspace:mysql大量数据java public void Get_WayId_Ref_isWay() throws IOException { PreparedStatement ps = null; Connection con=null; BufferedReader br=new BufferedReader(new FileReader(Path
推荐度:
导读mysql-Eclipse用JAVA连接Mysql插入大量数据报错Javaheapspace:mysql大量数据java public void Get_WayId_Ref_isWay() throws IOException { PreparedStatement ps = null; Connection con=null; BufferedReader br=new BufferedReader(new FileReader(Path

mysql大量数据java

public void Get_WayId_Ref_isWay() throws IOException
{

 PreparedStatement ps = null; Connection con=null; BufferedReader br=new BufferedReader(new FileReader(Path.path_read_beijing)); StringBuffer s=null; StringBuffer wayId=null; StringBuffer isWay=new StringBuffer("false"); String regex_nd="\\d+"; //用匹配 tmp=new ArrayList(); //找出way类的信息 if(batchCount%100==0) { ps.clearBatch(); } if(s.indexOf("0) { //获得每一组WayId Pattern p1=Pattern.compile(regex_id); Matcher m1=p1.matcher(s); if(m1.find()) { wayId=new StringBuffer(m1.group()); } while (s.indexOf("") <= 0) { count++; s=new StringBuffer(br.readLine()); //获得该wayid下的refid if(s.indexOf("0) { System.out.println("所在行数:"+count); Pattern p=Pattern.compile(regex_nd); Matcher m=p.matcher(s); if(m.find()) { tmp.add(new StringBuffer(m.group())); } } //判断该way是否为道路 if(s.indexOf("0||s.indexOf("0||s.indexOf("0) { isWay=new StringBuffer("true"); } } for(int i=0;i

ps=con.prepareStatement(sql1.toString());
ps.addBatch();

 } ps.executeBatch(); if(batchCount%100==0) { con.commit(); } } } } con.commit(); } catch (Exception e) { e.printStackTrace(); // TODO: handle exception }finally{ try { if(ps!=null) ps.close(); if(con!=null) con.close(); } catch (Exception e2) { e2.printStackTrace(); } } }

报的错误是:
java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:430)
at com.mysql.jdbc.PreparedStatement.getInstance(PreparedStatement.java:561)
at com.mysql.jdbc.ConnectionImpl.clientPrepareStatement(ConnectionImpl.java:1395)
at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4178)
at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4077)
at Wayid_To_Sql.Get_Map_Line_beta.Get_WayId_Ref_isWay(Get_Map_Line_beta.java:128)
at Wayid_To_Sql.Get_Map_Line_beta.main(Get_Map_Line_beta.java:35)

文档

mysql-Eclipse用JAVA连接Mysql插入大量数据报错Javaheapspace

mysql-Eclipse用JAVA连接Mysql插入大量数据报错Javaheapspace:mysql大量数据java public void Get_WayId_Ref_isWay() throws IOException { PreparedStatement ps = null; Connection con=null; BufferedReader br=new BufferedReader(new FileReader(Path
推荐度:
标签: 数据 java mysql
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top