Drive Letter And A FQFN (Fully Qualified Filename, OS:Windows), PDO

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Carlock

    Drive Letter And A FQFN (Fully Qualified Filename, OS:Windows), PDO

    function CreateMyDataBas eFile($FQFN, $UID, $PW) {
    $db = "sqlite:" . $FQFN;
    $sql = "CREATE TABLE Customers(name1 TEXT, name2 TEXT);";

    $dbh = new PDO($db, $UID, $PW);
    $dbh->exec($sql);
    $dbh = null;
    }

    This works as long as a drive letter is not FQFN. For instance,
    if, $FQFN = "Z:/mysql/dbn/data.db", PHP replies:

    SQLSTATE[HY000] [14]

    along with a couple lines of text identifying line numbers and such.

    The function above works well if FQFN = "./data.db". But, the
    database file must get set up on a different drive.

    Thanks.

    --
    Jim Carlock
    Post replies to the group.


  • Alvaro G. Vicario

    #2
    Re: Drive Letter And A FQFN (Fully Qualified Filename, OS:Windows), PDO

    *** Jim Carlock escribió/wrote (Thu, 17 May 2007 14:23:42 -0400):
    This works as long as a drive letter is not FQFN. For instance,
    if, $FQFN = "Z:/mysql/dbn/data.db", PHP replies:
    >
    SQLSTATE[HY000] [14]
    >
    along with a couple lines of text identifying line numbers and such.
    >
    The function above works well if FQFN = "./data.db". But, the
    database file must get set up on a different drive.
    Drive letters for network drives are not universal. Each user in the same
    computer will have different letters. If you run your script through a web
    server, the script will not have access to *your* letters but those of the
    user the services runs as (normally LocalSystem).

    I suggest you try with UNC paths, such as //server/share




    --
    -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    ++ Mi sitio sobre programación web: http://bits.demogracia.com
    +- Mi web de humor con rayos UVA: http://www.demogracia.com
    --

    Comment

    • Jim Carlock

      #3
      Re: Drive Letter And A FQFN (Fully Qualified Filename, OS:Windows), PDO

      *** Jim Carlock escribió/wrote (Thu, 17 May 2007 14:23:42 -0400):
      This works as long as a drive letter is not FQFN. For instance,
      if, $FQFN = "Z:/mysql/dbn/data.db", PHP replies:
      >
      SQLSTATE[HY000] [14]
      >
      along with a couple lines of text identifying line numbers and such.
      >
      The function above works well if FQFN = "./data.db". But, the
      database file must get set up on a different drive.

      "Alvaro G. Vicario" <webmaster@NOSP AMdemogracia.co mwrote:
      : Drive letters for network drives are not universal. Each user in the
      : same computer will have different letters. If you run your script through
      : a web server, the script will not have access to *your* letters but those
      : of the user the services runs as (normally LocalSystem).
      :
      : I suggest you try with UNC paths, such as //server/share

      The only problem there, is that no shares really exist... except the
      hidden shares. It's not a networked drive. It's a mapped drive letter
      created to shorten a path. Subst.exe was used to create the the drive
      letter.

      No network paths exist on the system. Group policies were set up to
      prohibit network paths I think.

      The code works on the physical drives, even the removable drives,
      for instance...

      function CreateMyDataBas eFile($FQFN, $UID, $PW) {
      $db = "sqlite:" . $FQFN;
      $sql = "CREATE TABLE Customers(name1 TEXT, name2 TEXT);";

      $dbh = new PDO($db, $UID, $PW);
      $dbh->exec($sql);
      $dbh = null;
      }

      CreateMyDataBas eFile("A:/test.db", "admin", "password") ;

      where A: represents a 3.5" disk drive. It just fails on a SUBST
      drive (mapped to a folder on another drive).

      Thanks for the suggestion.

      I've tried tricking it with things like, "./Z:/test.db" and "//Z:/test.db"
      but so far no luck.

      --
      Jim Carlock
      Post replies to the group.


      Comment

      • Toby A Inkster

        #4
        Re: Drive Letter And A FQFN (Fully Qualified Filename, OS:Windows),PDO

        Jim Carlock wrote:
        The only problem there, is that no shares really exist... except the
        hidden shares. It's not a networked drive. It's a mapped drive letter
        created to shorten a path. Subst.exe was used to create the the drive
        letter.
        Well, why not just specify the original long path?

        --
        Toby A Inkster BSc (Hons) ARCS
        Fast withdrawal casino UK 2025 – Play now & cash out instantly! Discover the top sites for rapid, secure payouts with no delays.

        Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

        Comment

        • Alvaro G. Vicario

          #5
          Re: Drive Letter And A FQFN (Fully Qualified Filename, OS:Windows), PDO

          *** Jim Carlock escribió/wrote (Thu, 17 May 2007 18:09:56 -0400):
          The only problem there, is that no shares really exist... except the
          hidden shares. It's not a networked drive. It's a mapped drive letter
          created to shorten a path. Subst.exe was used to create the the drive
          letter.
          Alright... I just figured out you were talking about networks paths.
          Anyway, what I said about drive letters being a per-user resource is still
          valid in your case. I've just linked a folder to letter M: and I've written
          this test script:

          <?php

          echo `dir M:`;

          ?>

          It works fine under command line (with my credentials) but it can't find
          the drive if I run it through my local web server (running as "Local
          System"). You can check the credentials of the Apache service running
          "services.m sc".

          If you want to use the drive letter under Apache you must find a way to run
          substr as Local System and then make sure that Local System user has write
          access to the specified folder. Or you can change the Apache credentials in
          the services console so it runs as a know user, then log in as that user
          and run substr. It's not a PHP issue.




          --
          -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
          ++ Mi sitio sobre programación web: http://bits.demogracia.com
          +- Mi web de humor con rayos UVA: http://www.demogracia.com
          --

          Comment

          Working...