Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6159609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:09:42+00:00 2026-05-23T21:09:42+00:00

I am trying to create a database on my sd card. Whenever I call

  • 0

I am trying to create a database on my sd card. Whenever I call SQLiteDatabase.openOrCreateDatabase I get the error:

07-21 13:33:17.587: ERROR/AndroidRuntime(5541): Caused by:
android.database.sqlite.SQLiteException: unable to open database file

Does anyone know what may be causing this? Here is the code I have in the open() method of my database class:

File sdcard = Environment.getExternalStorageDirectory();

String dbfile = sdcard.getAbsolutePath() + File.separator+ "external_sd" + File.separator + Schema.DATABASE_NAME ;

db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:09:43+00:00Added an answer on May 23, 2026 at 9:09 pm

    One possible fault on this could be that you did not set the appropriate permissions

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    

    However storing data on a SD Card is considered to be insecure. Because every application which has permissions to store data on the sd storage could access the database.

    Edit: Another possible problem is that external storage may not be available. You need to make sure that your external storage is currently writeable. One method would be to determine the state via getExternalStorageState (see reference here).

    getExternalStorageState() returns MEDIA_SHARED if the media is present not mounted, and shared via USB mass storage. 
    

    Reference. There is also a stackoverflow post on checking the state here: Writing Text File to SD Card fails

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to PHP oop stuff. I'm trying to create class database and call
I'm trying to create a hypothetical videostore database and this error message comes up
concerning android development, I'm simply trying to create an SQL database when the activity
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
im trying to create a database for a feedback application in ASP.net i have
I'm trying to create a Database object for myself in .net. The constructor takes
I am trying to create a database deadlock and I am using JUnit. I
I am trying to create a database of users with connection between users (friends
I'm trying to create a simple database table using the PHP MySQL query Create
I am trying to create new Event objects to be persisted in the database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.