0
我想从安装在真实设备上的应用程序的sqlite数据库读取数据到Windows计算机中。我想用USB电缆或任何其他方法连接两者,但不是互联网 1.这可能吗?是的,在调试模式下,我可以在eclipse的LogCat中看到数据,但我如何访问这些数据? 2.你能指点我一些可以帮助我解决这个问题的文献吗?使用USB数据线从我的应用程序的sqlite数据库中读取数据
我想从安装在真实设备上的应用程序的sqlite数据库读取数据到Windows计算机中。我想用USB电缆或任何其他方法连接两者,但不是互联网 1.这可能吗?是的,在调试模式下,我可以在eclipse的LogCat中看到数据,但我如何访问这些数据? 2.你能指点我一些可以帮助我解决这个问题的文献吗?使用USB数据线从我的应用程序的sqlite数据库中读取数据
将此代码添加到您的主要活动中,然后重新开始活动。确保此代码已被调用onc并设置适当的SD卡路径。在Windows上安装sqlite管理器工具并查看您的数据。
try
{
String inFileName = "//data/data/com.needzapp.debug/databases/your_db_name";
File dbFile = new File(inFileName);
FileInputStream fis = new FileInputStream(dbFile);
String outFileName = Environment.getExternalStorageDirectory()+"/NeedzApp_DB";
//Open the empty db as the output stream
OutputStream output = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer))>0){
output.write(buffer, 0, length);
}
//Close the streams
output.flush();
output.close();
fis.close();
}
catch (FileNotFoundException e)
{
Timber.e("File Not found ", e.toString());
}
catch (NullPointerException e)
{
Timber.e("NUll pointer" , e.toString());
}
catch (Exception e)
{
System.out.println("exception on exporting DB");
}
感谢您链接。上面的代码从设备中提取数据库并将其放在SD卡上,我可以访问它。你知道是否有一种方法可以使用VBA从Access连接到数据库? – user3267567
不用客气。 VBA?对不起,我没有意识到这一点。 – chain