#96 sqlite URI is not handled right on windows

closed-works-for-me
Oleg Broytman
None
5
2008-03-03
2008-02-29
No

On Windows machine when I try to connect to some sqlite database file, I am
receiving error message that says it was not possible to create (or open)
file.
I was inspecting code and found that path which is parsed from given URI
starts with '/', and on Windows no valid path starts with '/'.
I send in attachment new version of sqliteconnection.py
with three lines which on windows platform strips unwanted '/' from the
left of path.

Discussion

  • sqliteconnection module with inserted 3 lines

     
    Attachments
  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    Logged In: YES
    user_id=4799
    Originator: NO

    What DB URI causes a problem for you?

    PS. On Windows there are valid paths that start with '/' because / is the root of the current disk.

     
  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    • assigned_to: nobody --> phd
     
  • Logged In: YES
    user_id=2023531
    Originator: YES

    Thank you for explanation that '/' is root of the current disk. I didn't know that so I have tried all kinds of paths that were including disk name.
    Still, it seems to me that it is impossible to make connection to the file that exists on some other disk. Neither it is possible to make connection to the file given by its relative path.
    Ok, I know it is possible to find absolute path from relative one, than strip disk part of absolute path, but it seems too complicated.
    Anyway, thank you for your response.

     
  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    Logged In: YES
    user_id=4799
    Originator: NO

    It is not possible to use relative path, and I don't want to add the feature to SQLObject.

    But it is possible to use a full path with drive letter - just use a vertical bar as a separator instead of colon:

    db_uri = "sqlite:/C|/path/to/my.db"

    If that doesn't work for you - show the URI that causes problem.

     
  • Oleg Broytman
    Oleg Broytman
    2008-03-03

    • status: open --> closed-works-for-me