java导出csv 代码上下滚动代码01package com.du.string;0203import java.io.File;04import java.io.FileInputStream;05import java.io.FileOutputStream;06import java.io.InputStream;07import java.sql.Connection;08import java.sql.DriverManager;09import java.sql.ResultSet;10import java.sql.ResultSetMetaData;11import java.sql.Statement;12import java.util.Properties;1314public class Pro {1516public void run(){17try{181920Properties prot =new Properties();21InputStream fis=new FileInputStream(new File("./config.properties"));22prot.load(fis);23System.out.println(prot.getProperty("tables"));2425FileOutputStream fos=new FileOutputStream(prot.getProperty("csvpath"),true);26System.out.println(prot.getProperty("csvpath"));272829Class.forName(prot.getProperty("driver"));30Connection conn=DriverManager.getConnection(prot.getProperty("jdbc"),prot.getProperty("user"),prot.getProperty("password"));3132Statement st=conn.createStatement();33ResultSet rs= st.executeQuery("select * from "+prot.getProperty("tables"));34ResultSetMetaData rsmd=rs.getMetaData();35String columnC="";36for(int i=1;i<=rsmd.getColumnCount();i++){37columnC=columnC+rsmd.getColumnName(i).toString();38if(i
java导出cvs功能_java导出csv 代码
最新推荐文章于 2023-07-20 16:51:36 发布