Method getReadableDatabase () - opens the database for reading. getWritableDatabase () is for writing. Is there a method that opens a database for reading and writing at the same time?

    2 answers 2

    They both open (and create, if the base is missing) a base for both reading and writing.

    Difference in details:
    getReadableDatabase() will not throw an exception if at least read is available (for example, due to lack of disk space, it will return a database with read-only access, and will not throw an exception about not received access)

    getWritableDatabase() will throw an exception in any case of denied access (at least for reading, at least for writing).

    • those. I can call the getReadableDatabase () method for the database and update it? - Sergey
    • @ Sergey yes, you can call - pavlofff
    • Thanks I'll know. - Sergey

    In the docks so:

     getWritableDatabase() 

    It is also used for reading and writing.

    Creates or opens a database that will be used for reading and writing.

    Link here :