问题
In one of the questions regarding DBF creation, I found the code below. Did I understand correctly that a DBF file is created here with the names of the columns and the values that will be returned as a result of executing the SQL query? Does println do DBF output? And if everything is so, then how to save the resulting DBF file (name.dbf)?
I'm confused and can't figure it out with DBF. I need to create a DBF file and fill it with values by accessing a function in a SQL package. The second thing is clear to me, I can do it using sql.call and work with ResutSet, but how to save DBF to the computer further is not clear to me.
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String connString="jdbc:odbc:Driver={Microsoft dBASE Driver (*.dbf)};DefaultDir=E:\\db";//DeafultDir indicates the location of the db
Connection connection=DriverManager.getConnection(connString);
String sql="SELECT * FROM table_name where condition";// usual sql query
Statement stmt=connection.createStatement();
ResultSet resultSet=stmt.executeQuery(sql);
while(resultSet.next())
{
System.out.println();
}
System.out.println();
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
catch (SQLException e)
{
e.printStackTrace();
}
来源:https://stackoverflow.com/questions/65097720/how-to-save-a-dbf-file-in-groovy-or-java