Query Regarding csv file size problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swathi123
    New Member
    • Sep 2007
    • 2

    #1

    Query Regarding csv file size problem

    hi all
    here im trying to create .csv file.
    my code is

    public class CSVFile {

    public static void main(String[] args) {

    String record=null;
    try {
    Class.forName(" org.sqlite.JDBC ");


    Connection conn=DriverMana ger.getConnecti on("jdbc:sqlite :"+"C:\\Sqlite\ \retriver.db");
    Statement stmt = conn.createStat ement(); ResultSet rs = stmt.executeQue ry("select * from fileSystem");
    ResultSetMetaDa ta meta=rs.getMeta Data();
    int colCount=meta.g etColumnCount() ;
    int j=0;
    File fileStore = new File(fileStore. csv");
    FileOutputStrea m fos=new FileOutputStrea m(fileStore);
    long i=0;
    while(rs.next() )
    {

    record=rs.getSt ring(1)+","rs.g etString(2)","r s.getString(3)" ,"rs.getString( 4)","rs.getStri ng(5)","rs.getS tring(6)","rs.g etString(7)","r s.getString(8)" ,"rs.getString( 9)"\n";
    fos.write(recor d.getBytes());
    System.out.prin tln("counter"+( j++));

    }
    This is my code
    my problem is in my database i have 2,00,000 records
    but here i will get upto 65,000 records only

    i want to get all records
    is there any solution
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by swathi123
    hi all
    here im trying to create .csv file.
    my code is

    public class CSVFile {

    public static void main(String[] args) {

    String record=null;
    try {
    Class.forName(" org.sqlite.JDBC ");

    [code=java]
    Connection conn=DriverMana ger.getConnecti on("jdbc:sqlite :"+"C:\\Sqlite\ \retriver.db");
    Statement stmt = conn.createStat ement(); ResultSet rs = stmt.executeQue ry("select * from fileSystem");
    ResultSetMetaDa ta meta=rs.getMeta Data();
    int colCount=meta.g etColumnCount() ;
    int j=0;
    File fileStore = new File(fileStore. csv");
    FileOutputStrea m fos=new FileOutputStrea m(fileStore);
    long i=0;
    while(rs.next() )
    {

    record=rs.getSt ring(1)+","rs.g etString(2)","r s.getString(3)" ,"rs.getString( 4)","rs.getStri ng(5)","rs.getS tring(6)","rs.g etString(7)","r s.getString(8)" ,"rs.getString( 9)"\n";
    fos.write(recor d.getBytes());
    System.out.prin tln("counter"+( j++));

    }
    [/code]
    This is my code
    my problem is in my database i have 2,00,000 records
    but here i will get upto 65,000 records only

    i want to get all records
    is there any solution
    Use code tags while you do Post.
    Read the posting guidelines before posting :-)
    Are you getting 65,000 records out of 2,00,000 or you want to get 65,000 out of 2,00,000?
    I think you are getting 65,000 out of 2,00,000 :-)

    Actually you forgot to close the file o/p stream.
    [code=java]
    fos.close();
    [/code]
    Just close it after writing finishes.
    Good Luck :-)

    Kind regards,
    Dmjpro.

    Comment

    Working...