在关于dbf创建的一个问题中,我找到了下面的代码。我是否正确地理解了dbf文件是在这里创建的,其中包含列的名称和执行sql查询将返回的值?println做dbf输出吗?如果一切都是这样,那么如何保存生成的dbf文件(name.dbf)?
我很困惑,不能用dbf来解释。我需要创建一个dbf文件,并通过访问sql包中的函数来用值填充它。第二件事我很清楚,我可以使用sql.call和resutset来完成,但是如何进一步将dbf保存到计算机上我并不清楚。
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();
}
暂无答案!
目前还没有任何答案,快来回答吧!