0

I am writing a small library that all it does is opens a connection with the local SqliteDb present just near the application and reads from the database depending on the search query.

The one using this library does not need the access to Insert or update any record but are updated from lets say me.

SO to create a database i use this:

SqlConnection = new SQLiteConnection("Data Source=Languages.db;Version=3;New=True;Compress=True");

Than to access the database the same but New=False

Now i am using Firefox Sqlite Manager to modify the table such as creating the structure and adding values.

But when i save the file with firefox i get an error on C# stating that it is write/read protected when i try to open the connection!!

Edit: I also tried to use Sqlite Browser: http://sqlitebrowser.org

but then i got that unsupported file format!

Am i missing something?

Regards

Combinu
  • 882
  • 2
  • 10
  • 31

2 Answers2

1

The FireFox SQL Lite Manager when open, restricts other applications from making a connection to the SQL Lite database. If you shut down the FireFox Manager, your C# code will execute correctly.

You can refer this answer to understand the nature of the lock applied by Firefox Firefox locks places.sqlite

Community
  • 1
  • 1
Praveen Paulose
  • 5,741
  • 1
  • 15
  • 19
  • I am closing infact firefox because i thought that there should be only one client but still i get that error – Combinu Apr 09 '15 at 11:36
  • Instead of just closing FireFox, try disconnecting database from FireFox SqlLite Manager. – Praveen Paulose Apr 09 '15 at 11:42
  • Also tried that i chose close database and firefox shows that there is no database selected. Btw i am using the Finisar SQLite driver – Combinu Apr 09 '15 at 11:48
  • I have noted that if i create a DB with C# and open it with firefox and close it again, i get no error but if i create a new table i get the error – Combinu Apr 09 '15 at 12:03
  • Try this. Create the database using SQLLite Manager, add tables to it. Disconnect the database and try connecting it from C# without New=True in your connection string. Let me know the results. – Praveen Paulose Apr 09 '15 at 12:11
  • I have also tried that and still not working. Although i think i have found the problem which is answered below! – Combinu Apr 09 '15 at 12:30
0

I have noticed that when creating a table or altering the table somehow from the SQL manager gui, the gui itself creates some headers/meta data that the driver is not able to read and thus it flags it as corrupted.

To solve the issue all i had to do is create the tables and alter as necessary from my application directly,than i can add records using the firefox manager and it seems to be working correctly!

Correct me if im wrong!

Combinu
  • 882
  • 2
  • 10
  • 31