1

I am trying to export a lot of large tables from a MS Access db with java using the jdbc:odbc bridge. I wanted to save these tables to a CSV file first was wondering what would the best way to do this would be? any help would be appreciated.

4

3 に答える 3

3

値を取得し、値を行ごとに区切って標準のテキスト ファイルに書き込みます。この目的のためのいくつかのライブラリがあると確信しています

try
{
 FileWriter writer = new FileWriter("c:\\temp\\MyFile.csv");
 while(result.next())
 {
 for(int i = 0; i < columnSize; i++)
 {
    writer.append(result.getObject(i));
    if(i < columnSize - 1)
       writer.append(',');
 }
 writer.append('\n');
 }
 }
 catch(Exception e)
{
  e.printStackTrace();
}
于 2011-06-23T09:20:34.320 に答える
1

opencsv http://opencsv.sourceforge.netを使用できます

于 2011-06-23T09:48:16.283 に答える