java connection Read-only file system

Viewed 160

In Android Studio. I have been on and off programming for a few years. Trying to get back into it once again. I wrote the code below to connect, query and then update the sqlite database in a while loop. However, I am doing something wrong because I am getting a read-only file system error. I have put in bogus db strings and I get the same error.

I have been trying to figure out the solution for over 2 weeks now and the keyboard is about to fly across the room. Any ideas are appreciated!


String url = "jdbc:sqlite:currentDBPath";
 
SQLiteConfig config = new SQLiteConfig();

config.setOpenMode(SQLiteOpenMode.READWRITE);

java.sql.Connection con = DriverManager.getConnection(url, config.toProperties());

Statement stmt = con.createStatement(
         ResultSet.TYPE_SCROLL_INSENSITIVE,
         ResultSet.CONCUR_UPDATABLE);
         ResultSet rs = stmt.executeQuery("Select id from round_table");

java.sql.SQLException: opening db: 'currentDBPath': Read-only file system
0 Answers
Related