Problem with COM on just one machine?

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

    Problem with COM on just one machine?

    Hi All,

    Running PHP 5.1.6 on a Windows Server 2003 machine, running as a CGI
    under IIS 6. I call a class in each of my pages that performs an LDAP
    query to automatically look up user name / email / other details (this
    is taking place on a company intranet).

    This works fine on every machine tested, except 1 - on which the code
    throws the following error:

    Fatal error: Uncaught exception 'com_exception' with message
    '<b>Source:</bProvider<br/><b>Description :</bTable does not
    exist.' in D:\inetpub\wwwr oot\itracker\in clude\classes.p hp:59 Stack
    trace: #0 D:\inetpub\wwwr oot\itracker\in clude\classes.p hp(59): com-
    >Execute() #1 D:\inetpub\wwwr oot\itracker\in dex.php(9):
    visitor_details->perform_lookup () #2 {main} thrown in D:\inetpub
    \wwwroot\itrack er\include\clas ses.php on line 59

    The code being executed is this:

    $myid = $_SERVER["LOGON_USER "];
    $this->userid = $myid;
    $conn = New COM("ADODB.Conn ection");
    $rs = New COM("ADODB.Reco rdset");
    $com = New COM("ADODB.Comm and");
    $conn->Provider = "ADsDSOObje ct";
    $conn->Open("Active Directory Provider");
    $com->ActiveConnecti on = $conn;
    $str = "SELECT sn, givenname, mail FROM 'LDAP://
    DC=core,DC=dir, DC=mycompany,DC =com' WHERE objectCategory = 'Person'
    AND objectClass = 'user' AND samAccountname = '$myid'";
    $com->CommandText = $str;
    $rs = $com->Execute();

    The error is on the $com->Execute() line. I've tried hard-encoding the
    id into the query (works on every machine other than the one throwing
    the above error).

    I'm confused, because as I understand it, this code is running on the
    server machine, not on the client machines (unless there's something
    different about COM?), and there should be no reason that the page
    returns the expected result on my machine and returns the error on the
    problematic one. I would have thought we should both work or both
    fail, particularly when I hard code the variable values to take any
    variability out.

    Can anyone give me any help figuring this out?

    Many thanks in advance,

    pt

  • planetthoughtful

    #2
    Re: Problem with COM on just one machine?

    On Feb 2, 1:41 pm, "planetthoughtf ul" <planetthought. ..@gmail.com>
    wrote:
    I'm confused, because as I understand it, this code is running on the
    server machine, not on the client machines (unless there's something
    different about COM?), and there should be no reason that the page
    returns the expected result on my machine and returns the error on the
    problematic one. I would have thought we should both work or both
    fail, particularly when I hard code the variable values to take any
    variability out.
    Hi All,

    In case anyone's interested, or in case this is of help to someone in
    future, the fix for my problem was changing the string used for the
    LDAP server from:

    $str = "SELECT sn, givenname, mail FROM 'LDAP://
    DC=core,DC=dir, DC=mycompany,DC =com' WHERE objectCategory = 'Person'
    AND objectClass = 'user' AND samAccountname = '$myid'";


    To:

    $str = "SELECT sn, givenname, mail FROM 'LDAP://
    core.dir.mycomp any.com' WHERE objectCategory = 'Person' AND
    objectClass = 'user' AND samAccountname = '$myid'";

    (Note: in case it isn't evident, "mycompany" is not a real value)

    I still have no idea why the first string worked on all client
    machines but one, and why the second string works on all (tested)
    machines. I was under the impression this would all happen on the
    server machine. Still, there it is.

    Again, hope this helps someone else.

    pt

    Comment

    Working...