Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

database - Android Utility to send sqlite db to server

In my application I want to send data stored in the local sqlite database to server's sqlserver database. Is there any utility for android to directly send the .db file and read the content in the server. Writing multiple insert statements will make code very lengthy and will cause in the primary key violation. Please help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When you create the database you are specifying the database name (for instance products.db). If your application package name is com.example.yourapplicationpackage, you can access the file using the path: /data/data/com.example.yourapplicationpackage/databases/products.db

Then you can send that file just like any other file to your server (use a POST request). On the server side, you need classes to read a SQLite 3 database file, this should not be hard to find.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...