PHP & Attunity Connect problem

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

    #1

    PHP & Attunity Connect problem

    I am trying to connect to a legacy system running on VMS using the
    Attunity Connect ODBC driver from within PHP. I know the System DSN
    works because SQL Server has been using it successfully for years. I
    want to access the info on VMS from within PHP and this is when all
    goes pear shaped!

    I have tried various ways...

    1) If I am in query analyser and type 'SELECT * FROM
    DNSNAME...TABLE NAME' etc. This works fine. But if I try putting this
    within a SQL string within PHP I get the following error..
    "Hetrogeneo us queries require the ANSI_NULLS and ANSI_WARNINGS options
    to be set for the connection. This ensures consistent query
    semantics.....
    Varies postings relating to this very message appear on groups, most of
    which state to set these ANSI variables and try again. I have but still
    no joy!

    2)From within PHP just create a normal ODBC connection, refere to the
    DSN in question and try a query such as:-

    <?php

    $link_id = odbc_connect ('DSNNAME','',' ');//Links to database

    if ($link_id){
    echo "connected to DSNNAME!!<br>";
    $sql = "SELECT top 10 proj_name, area
    FROM projects";
    $exec = odbc_exec($link _id, $sql);
    }

    if ($exec)
    {
    echo "selection completed<br>";
    while ($row = odbc_fetch_row ($exec))
    echo $row->id."<br>";
    }
    else
    echo "ERROR - connecting to DSNNAME!!";
    ?>


    This also fails, with the following message...
    SQL error:[Attunity][Attunity Connect Driver][A077]DS Name DSNNAME does
    not appear in the binding entry.,SQL state S1000 in SQLConnect in
    d:\intranet\tes t scripts\dsntest .php

    As a final straw I tried connecting by using the method....
    $conn = new COM('ADODB.Conn ection');
    $conn->open("DRIVER={ Attunity Connect Driver}).... etc....

    No diffrent....

    I can connect to a simple Access database by setting up an ODBC
    source...
    So there seems to be an issue between PHP and the Attunity Driver, and
    I am now officially annoyed....

    Has anyone else tried a similar combination because I would desperately
    like to chat with you!

  • Worst

    #2
    re:PHP &amp; Attunity Connect problem

    I'm trying to use Attunity Connect on PHP/Linux too (Debian).
    Have you solve your problem ? If yes, a little help would be
    appreciate :)

    I think you can't put an URL in the DSN. You have to use a software
    like unixodbc to configure an ODBC link. Then, in your web page, you
    must point on your ODBC link.

    I tried on a Windows Host, with succes. I installed an Attunity Sdudio
    on my machine, and made an ODBC link 'Tolas'.
    In my PHP page, I used the DSN : "odbc://Tolas"

    Now, for Linux, I have absolutely no idea on how to do :'(
    http://eye.cc -php- web design

    Comment

    • Gazchurchend

      #3
      Re: re:PHP &amp; Attunity Connect problem

      Hi glad to hear from you... Hope your still viewing the post, I almost
      forgot about it myself!

      I would be interested in seeing a code example of how you got it
      working in a Windows environment, as I thought I had done exactly as
      you did.

      Was there and special settings in the ini file?
      I can't see anything there that iv'e missed.

      I'me afraid my situation is pure Windows and not Linux, so don't think
      I can help you on that one. I assumed the problem to be because the
      ODBC link is referencing a seperate VMS machine, however collegues of
      mine use the very same ODBC link through VB and ASP! I figured there
      was something dodgy with PHP. Anyhow I will revisit the problem today.
      If you do get to the bottom of your linux problem please do let me
      know, as you never know which technologies are going to be thrown at
      you!

      Cheers


      Worst wrote:[color=blue]
      > I'm trying to use Attunity Connect on PHP/Linux too (Debian).
      > Have you solve your problem ? If yes, a little help would be
      > appreciate :)
      >
      > I think you can't put an URL in the DSN. You have to use a software
      > like unixodbc to configure an ODBC link. Then, in your web page, you
      > must point on your ODBC link.
      >
      > I tried on a Windows Host, with succes. I installed an Attunity Sdudio
      > on my machine, and made an ODBC link 'Tolas'.
      > In my PHP page, I used the DSN : "odbc://Tolas"
      >
      > Now, for Linux, I have absolutely no idea on how to do :'(
      > http://eye.cc -php- web design[/color]

      Comment

      Working...