[MonoDevelop] Sqlite issue

Dan Winslow DWinslow at aiminstitute.org
Tue Jul 7 12:25:36 EDT 2009


(Code follows question)          

 

This code raises 

 

Unhandled Exception: Mono.Data.Sqlite.SqliteException: Attempt to write
a read-only database

attempt to write a readonly database

  at Mono.Data.Sqlite.Sqlite3.Reset (Mono.Data.Sqlite.SqliteStatement
stmt) [0x0007b] in
/builddir/build/BUILD/mono-2.4/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqli
te_2.0/SQLite3.cs:210 

  at Mono.Data.Sqlite.Sqlite3.Step (Mono.Data.Sqlite.SqliteStatement
stmt) [0x0002c] in
/builddir/build/BUILD/mono-2.4/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqli
te_2.0/SQLite3.cs:139 

  at Mono.Data.Sqlite.SqliteCommand.ExecuteNonQuery () [0x00026] in
/builddir/build/BUILD/mono-2.4/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqli
te_2.0/SQLiteCommand.cs:558 

  at (wrapper remoting-invoke-with-check)
Mono.Data.Sqlite.SqliteCommand:ExecuteNonQuery ()

  at logsharp.MainClass.Main (System.String[] args) [0x001c0] in
/home/dwinslow/Desktop/metrix/logsharp/Main.cs:45

 

Does anyone know why? The file permissions are fine.

 

(CODE)

 

  StreamReader re =
File.OpenText("/home/dwinslow/Desktop/metrix/200926.sorted.log");

             string input = null;

                                     int linecount=0;

                                    

                                     SqliteConnection dbh=new
SqliteConnection("URI=file:/home/dwinslow/Desktop/metrix/weblog.db");

                                     SqliteCommand cmd=new
SqliteCommand("");

                                    

                                     dbh.Open();

                                     cmd.Connection=dbh;

                                    

             while ((input = re.ReadLine()) != null)

             {

                //Console.WriteLine(input);

                                                string[]
parts=input.Split(' ');

                                                linecount++;

                                                StringBuilder[] S=new
StringBuilder[10];

                                                S[0]=new
StringBuilder(parts[0]);

                                                S[1]=new
StringBuilder(parts[1]);

                                                S[2]=new
StringBuilder(parts[4].TrimStart('['));

 
S[2][S[2].ToString().IndexOf(':')]=' ';

                                                S[3]=new
StringBuilder(parts[6].TrimStart('"'));

                                                S[4]=new
StringBuilder(parts[7].Trim('"'));

                                                S[5]=new
StringBuilder(parts[9].Trim('"'));

                                                S[6]=new
StringBuilder(parts[10].Trim('"'));

                                                S[7]=new
StringBuilder(parts[11].Trim('"'));

                                                S[8]=new
StringBuilder(parts[12].Trim('"'));

                                                

                                                

                                                

            cmd.CommandText=String.Format(

            "insert into log values
('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",

 
S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[8]);

            Console.WriteLine(cmd.CommandText);

            cmd.ExecuteNonQuery();                                   

 

Dan Winslow
Director of Information Technology, AIM INSTITUTE
1905 Harney Street, Suite 700
Omaha, NE 68102
402-345-5025 x156
dwinslow at aiminstitute.org
www.aiminstitute.org

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20090707/478e4809/attachment-0001.html 


More information about the Monodevelop-list mailing list