public static void test4() throws ClassNotFoundException, SQLException {
String fileName = "";
ArrayList<DDebtorInfo> ddList = new ArrayList<DDebtorInfo>();
FileOutputStream out = null;
FileOutputStream out1 = null;
FileOutputStream out2 = null;
FileOutputStream out3 = null;
FileOutputStream out4 = null;
FileOutputStream out5 = null;
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
StringBuilder sb3 = new StringBuilder();
StringBuilder sb4 = new StringBuilder();
StringBuilder sb5 = new StringBuilder();
try {
out = new FileOutputStream(new File(fileName+ "remark.sql"));
out1 = new FileOutputStream(new File(fileName+ "remark1.sql"));
out2 = new FileOutputStream(new File(fileName+ "remark2.sql"));
out3 = new FileOutputStream(new File(fileName+ "remark3.sql"));
out4 = new FileOutputStream(new File(fileName+ "remark4.sql"));
out5 = new FileOutputStream(new File(fileName+ "remark5.sql"));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String remark = "";
String remark1 = "";
String remark2 = "";
String remark3 = "";
String remark4 = "";
String remark5 = "";
String URL="数据库地址";
String USER="用户";
String PASSWORD="密码";
//1.加载驱动程序
Class.forName("com.mysql.jdbc.Driver");
System.out.println("加载驱动=============");
//2.获得数据库链接
Connection conn=DriverManager.getConnection(URL, USER, PASSWORD);
System.out.println("获取连接=============");
//3.通过数据库的连接操作数据库,实现增删改查(使用Statement类)
PreparedStatement st= null;
Resu
JDBC读取数据库,生成csv文件
最新推荐文章于 2022-12-09 22:59:30 发布