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