[英]Where do i put the .mdb database file using Jackcess..?
This might be a ridiculous question, but I can't find an answer anywhere... 这可能是一个荒谬的问题,但我在任何地方都找不到答案...
I have a Microsoft Access database called test.mdb. 我有一个名为test.mdb的Microsoft Access数据库。 I use the Jackcess library to try to open it using the following code taken from official documentation here
我用的是Jackcess库尝试使用从官方文档采取以下代码来打开它在这里
Database db = DatabaseBuilder.open(new File("mydb.mdb"));
Sounds simple enough, but where exactly do I place my "test.mdb"?! 听起来很简单,但是我应该将“ test.mdb”放在哪里呢?
Tried putting in the the assets folder and used file:///android_asset/test.mdb but that didn't help. 尝试放入资产文件夹并使用file:///android_asset/test.mdb,但这没有帮助。 I still get
FileNotFoundException
我仍然收到
FileNotFoundException
You must check database file first. 您必须先检查数据库文件。
1. 1。
2.File dbfile = new File("mydb.mdb"); public void Connect() { try {
if (dbfile.exists() && !dbfile.isDirectory()) { db = DatabaseBuilder.open(dbfile); } else { int warning= JOptionPane.showConfirmDialog(null, "Yeni bir veritabanı oluşturulsunmu?", "Mevcut Bir Veritabanı Bulunamadı", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (uyari == JOptionPane.YES_OPTION) { Create(); } else { System.exit(0); }
public void Olustur() { try { db = DatabaseBuilder.create(Database.FileFormat.V2010, dbfile); } catch (IOException ex) { }
This will create new db on your project folder. 这将在您的项目文件夹上创建新的数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.