小编典典
Jackcess 2.x的更新:现在使用来创建(或打开)DatabaseBuilder数据库,因此我们要创建一个新的数据库文件
import java.io.File;
import java.io.IOException;
import com.healthmarketscience.jackcess.Database;
import com.healthmarketscience.jackcess.Database.FileFormat;
import com.healthmarketscience.jackcess.DatabaseBuilder;
public class JackcessDemoMain {
public static void main(String[] args) {
String dbPath = "C:/Users/Public/newDb.accdb";
// using try-with-resources is recommended to ensure that
// the Database object will be closed properly
try (Database db = DatabaseBuilder.create(FileFormat.V2010, new File(dbPath))) {
System.out.println("The database file has been created.");
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
}
}
}
Jackce