Java将mysql输出csv,如何从Java中的Access数据库导出表并将其保存到.csv
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.
解決方案
Fetch the values and write a standard text file line by line separating the values. I#m sure there are some libs for this purpose
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();
}
總結
以上是生活随笔為你收集整理的Java将mysql输出csv,如何从Java中的Access数据库导出表并将其保存到.csv的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysqlls_mysql基本命令
- 下一篇: mysql中没有内置函数_[mysql]