[Haskell-beginners] Can't find or open a Sqlite3 database inWindows Vista

Patrick Lynch kmandpjlynch at verizon.net
Thu Feb 3 20:40:09 CET 2011


...just to put the 'finishing touch' on this -- Daniel Fischer pointed out how to use the Windows back slash for this command [he pointed it out that GHCI consider the backspace to be an escape character] - note the use of the double back slashes:

   Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "c:\\users\\user\\test1.db"
   Prelude Database.HDBC Database.HDBC.Sqlite3>

Thanks Daniel...
  ----- Original Message ----- 
  From: Patrick Lynch 
  To: Patrick Lynch ; beginners at haskell.org 
  Sent: Thursday, February 03, 2011 1:01 PM
  Subject: Re: [Haskell-beginners] Can't find or open a Sqlite3 database inWindows Vista


  ...oh dear, guess what -- I told you a lie...ghci does except either c:/users/user/test1.db or /users/user/test1.db but not the Windows folder separator of backslash '\'...please see following:

  ...this works:
      Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "c:/users/user/test1.db"
      Prelude Database.HDBC Database.HDBC.Sqlite3>

  ...so does this:
      Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "/users/user/test1.db"
      Prelude Database.HDBC Database.HDBC.Sqlite3>

  ...this doesn't work, note the back slash...also, this will only work, that is to create the database automatically and then subsquently create a table, if you user the 'users' folder...if you use 'program files, etal' you will not be able to create the database...bummer:
     Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "c:\users\user\test1.db"
     <interactive>:1:27:
         lexical error in string/character literal at character 'u'

  ---- Original Message ----- 
    From: Patrick Lynch 
    To: Patrick Lynch ; beginners at haskell.org 
    Sent: Thursday, February 03, 2011 11:24 AM
    Subject: Re: [Haskell-beginners] Can't find or open a Sqlite3 database inWindows Vista


    ...this seems to work: 
       ghci> conn <- connectSqlite3 "/users/user/test1.db"

    ...this allows me to create a database in this directory, named test1.db, and then I can create a table in this database...
    ...I'm now working on writing some queries...

    ...wish me luck
      ----- Original Message ----- 
      From: Patrick Lynch 
      To: Kathleen Lynch ; beginners at haskell.org 
      Sent: Thursday, February 03, 2011 10:08 AM
      Subject: Re: [Haskell-beginners] Can't find or open a Sqlite3 database inWindows Vista


      ...could this be the problem...in Windows Vista I cannot change the file name in the directory c:\Program Files (x86)\Haskell Platform\2010.2.0.0\winghci but can change it in c:\users\user directory...

          ...> ren  "c:\Program Files (x86)\Haskell Platform\2010.2.0.0\winghci\test1.db" test2.db
          Access is denied.

      ...but I can see the contents of this file:

          ...> type test1.db
          hello, world!

      ...is it possible to specify the directory c:\users\user in ghci so that Sqlite3 will look there to open the database and then to create a table in it?

      Good day

      ----- Original Message ----- 
        From: Kathleen Lynch 
        To: beginners at haskell.org 
        Sent: Wednesday, February 02, 2011 5:28 PM
        Subject: [Haskell-beginners] Can't find or open a Sqlite3 database in Windows Vista


        ...seems like I 'kicked over another bee hive'...plenty of messages in regard to this when you do google search--->[sqlite3.operational error unable to open database file in windows vista]

        ...i'm getting the following error messages when I try to create a database in Sqlite3:

        *Sandbox> dbh <- connect "poddbtest.db"
        *** Exception: SqlError {seState = "", seNativeError = 21, seErrorMsg = "prepare 6: BEGIN: unable to open database file"}

        *Sandbox> dbh <- connect "test1.db"
        *** Exception: SqlError {seState = "", seNativeError = 1, seErrorMsg = "step: SQL logic error or missing database"}

        Both come from Chapters 21 and 22 in "Real World Haskell"

        I can't invoke Sqlite3 from the command line using---> Sqlite3 myDatabase.db...
        I created blank files in folder C:\Program Files (x86)\Haskell Platform\2010.2.0.0\winghci -- seemed to get me a bit further along...at least I was able to connect...

        Is it possible to specify the folder that the database should be created in?
        Is it possible to run Sqlite3 from the command line - when it has been installed using the Haskell wiki?
        Has anyone had better success with MySql - I've used it in the past and it was very reliable?

        Thank you




------------------------------------------------------------------------


        _______________________________________________
        Beginners mailing list
        Beginners at haskell.org
        http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110203/c4b203ce/attachment-0001.htm>


More information about the Beginners mailing list