views:

34

answers:

1

I am currently working on a java program that inserts excel data into android database(sqlite).

when i place the TestDB(sqlilte db) into c:drive it works.

Connection con = DriverManager.getConnection("jdbc:sqlite:C:\\TestDB");

But it won't work on android(emulator) database. The database have been created in android.

Connection con = DriverManager.getConnection("jdbc:sqlite://127.0.0.1:5554:/data/data/com.app.das/databases/TestDB");

i am guessing that the tcp is wrong. how do i go about fixing it?

+1  A: 

I'm afraid you're not able to connect to emulator's database directly.

So pull database file, edit it and push it back:

adb pull /data/data/com.app.das/databases/TestDB c:\TestDB

then

Connection con = DriverManager.getConnection("jdbc:sqlite:C:\\TestDB");
... do your job ...

and at the end

adb push c:\TestDB /data/data/com.app.das/databases/TestDB 
Gawcio
hi gawcio, thanks for your response.For my project, i have to create a program that pushes excel data into emulator's database directly. Do you have any other alternative solution to it?