Import sqlite database already populated

Asked

Viewed 1,159 times

4

I’m making an app requires only queries in a database. Since this is a very large amount of data, I think it would be counterproductive to feed this database using a insertOrThrow for each item of a table. I don’t know the best way to perform this operation, so I’m doing a procedure kind of "blindly" here, but it’s not being very effective. To enter this data I used the utility Sqlitestudio. Has anyone there ever performed such an operation? Which database manager do you suggest to use? I’m having difficulty importing this database generated in the manager into the Android Studio project. So I searched, it is necessary to create a folder called Assets in the project and put the database inside.

About the import, I found information to use the class Inputstream, but I could not load the file information. During the execution, in the procedure to list the data, enter the Cath and says no table was found in the bank. The larger purpose of this question is to get advice on how to perform a large volume data insertion operation in a database and use it for query through Android Studio. Anyone who can contribute, thank you. Hugging!

  • 1

    I think this link can help...

1 answer

1


Good afternoon Fabio, I believe that do the Insert with insertOrThrow no problem no. I built an application that first synchronization it inserts about 40 thousand records.

I haven’t even found a problem with that so far, as I do this lengthy process only the first time.

It’s been running on dozens of devices for about 20 months.

  • Good afternoon, Eduardo! In this case, are you making the inclusion of each record within your code? Maintenance is not complicated?

  • For example, did you do something like this for each of the records? Contentvalues value = new Contentvalues(); value.put("NAME", "Fabio"); value.put("TEELFONE", "000000"); connection.insertOrThrow("CLIENT", null, values);

  • that, correctly. Only I have a method that has as parameter the object. I only ask an object and call the method.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.