Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#65 Trouble connecting on win32 and with alias

closed-fixed
Oleg Broytman
5
2005-04-05
2005-03-24
Henrik Weber
No

This is for SQLObject 0.6.1 (and 0.6).

In the _parseURI method of the DBConnection class on
line 95 a path to the database is built by taking the
content of the variable "rest" and prepending a slash.

On win32 a connection URI like this:

firebird://sysdba:masterkey@localhost/C:\DBPATH\DBN
AME.FDB?dialect=3

ends up with this path:

/C:\DBPATH\DBNAME.FDB

which leads to an error.

Also this makes it impossible to use Firebird database
aliases on win32 as well as on other systems:

firebird://sysdba:masterkey@localhost/DBALIAS?
dialect=3

results in

/DBALIAS

which again doesn't work.

For my system removing the line works pretty well, but I
guess it is there for a reason, so a somewhat more
sophisticated solution is needed.

Discussion

  • Oleg Broytman
    Oleg Broytman
    2005-03-30

    Logged In: YES
    user_id=4799

    if os.name == 'nt' the slash is not prepended. What is the
    os.name on your platform?

    BTW, the correct URI synatx is
    firebird://sysdba:masterkey@localhost/C|/DBPATH/DBNAME.FDB?dialect=3

     
  • Oleg Broytman
    Oleg Broytman
    2005-03-30

    • assigned_to: nobody --> phd
     
  • Henrik Weber
    Henrik Weber
    2005-03-30

    Logged In: YES
    user_id=121229

    os.name is "nt", so that would work. I just can't find that line
    in the module. Has it been added after version 0.6.1? I haven't
    figured out yet how to look into the versioning system.

    Anyway, I like the database alias feature of Firebird because I
    can move the database around without having to change the
    configuration of all applications that use it. Querying for
    os.name == 'nt' will solve that problem for win32, but not for
    other OSs.

    Hmm, the other syntax worked just fine when no slash was
    prepended.

     
  • Oleg Broytman
    Oleg Broytman
    2005-03-30

    Logged In: YES
    user_id=4799

    This test appeared much later. It is in Subversion
    repository now. Download an unofficial tarball, ot checkout
    the SVN version.

    About alisases... how can one distinguish if this is an
    alias in the URL or a full path without a drive letter?

     
  • Henrik Weber
    Henrik Weber
    2005-03-30

    Logged In: YES
    user_id=121229

    That's probably difficult to get completely right. Maybe one
    could check if the file given in the URI exists in the
    filesystem. If it doesn't, don't prepend the slash.

     
  • Oleg Broytman
    Oleg Broytman
    2005-03-30

    Logged In: YES
    user_id=4799

    Meaningless. If the path is /DBALIAS - is it on the current
    process' drive or on the Firebirrd's drive?

    The only solution I can imagine is to strp the leading slash
    after the call to _parseURI().

     
  • Henrik Weber
    Henrik Weber
    2005-03-30

    Logged In: YES
    user_id=121229

    What if it were possible to mark aliases as such with some
    kind of syntax? Just as Windows has driver letters, one could
    prefix an alias with something distinctive. Maybe a "drive
    letter" that is impossible for a Windows drive like:

    al:DBALIAS

    or something in that direction.

     
  • Oleg Broytman
    Oleg Broytman
    2005-04-05

    Logged In: YES
    user_id=4799

    Please try the attached patch and report if it helps.

     
  • Oleg Broytman
    Oleg Broytman
    2005-04-05

    Strip the leading slash

     
  • Henrik Weber
    Henrik Weber
    2005-04-05

    Logged In: YES
    user_id=121229

    It works for me, but doesn't it break something for non-
    windows users?

     
  • Oleg Broytman
    Oleg Broytman
    2005-04-05

    Logged In: YES
    user_id=4799

    Nice questions. Let me protect the patch and appli it only
    on w32. Applied and committed at SVN revision 716.

     
  • Oleg Broytman
    Oleg Broytman
    2005-04-05

    • milestone: 293287 --> SQLObject_from_repository
    • status: open --> closed-fixed