开发者

is there any limit on the number of rows one can select in MySQL?

There are 1652487 rows in my table in MYSQL. I want to copy all the values corresponding to one field into a file. I wrote a java program in netbeans using jdbc d开发者_运维技巧river for this. I'm unable to do this at one go. Is there a way out ? < Is there any limit on the number of rows one can select >

[ EDIT ]

my code : action performed when a button is pressed :

 private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        try
        {
        File fo=new File("D:\\dmoz_externalpages.txt");
        FileWriter fro=new FileWriter(fo);
        BufferedWriter bro=new BufferedWriter(fro);
        Connection con=null;
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        con=DriverManager.getConnection("jdbc:mysql://localhost:3306/dmozphp","root","");
        PreparedStatement ps=con.prepareStatement("select externalpage from content_description");
        ResultSet rs=ps.executeQuery();
        while(rs.next())
        {        
            bro.write(rs.getString(1));
            bro.newLine();
            bro.flush();
        }
        }
        catch(Exception e)
        {
            System.out.println(e);
        }

    }       

when i run this , i get the following exception :

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space


There is no MySQL limit on this. My strong guess is you're limited by the memory on the client side.

I've been able to export entire tables with >25mil rows without problems before.

If you want to export the data the quickest way, use SELECT INTO OUTFILE or give Maatkit a go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜