Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    6

    Unanswered: db2_prepare error

    Where can I go to decipher PHP errors messages; specifically, the db2_prepare and db2_bind_param have such generic message, and I am just not experienced enough to know what they mean.

    Here is my code:
    Code:
    // Parse work order number //
    $account = "";
    $account = $_GET['account'];
    
    // Set up SQL statement //
    $sql = 'SELECT ODWONR, ODSYSN, ODSVCD, ODSTYP FROM worddpl2 WHERE ODWONR = ?';
    $stmt = db2_prepare($conn, $sql);
    
    // Bind parameters //
    db2_bind_param($stmt, 1, "account", DB2_PARAM_IN);
    
    // Execute and display SQL results //
    if (db2_execute($stmt)) {
       while ($row = db2_fetch_array($stmt)) {
           print "{$row[0]}, {$row[1]}, {$row[2]}, {$row[3]} \n";
       }
    }
    It is generating this error message:

    Warning: db2_prepare() [function.db2-prepare]: Statement Prepare Failed in /www/zendcore/htdocs/cox/query_workorder.php on line 38

    If fails, but why?

  2. #2
    Join Date
    Mar 2009
    Posts
    6
    I got it working by hard-coding the library name. Does anyone out there have anything similar to this? Why doesn't the SQL use the jobs library list to find the file?

    Code:
    $sql = 'Select odcnbr, odwonr, odsysn, odsvcd, odstyp FROM PHXQACMF.worddpl2 Where odcnbr = ?';

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    if you are connected to db with usera it will prefix all objects with usera if not specified. hence the error, because the object does not exists
    always specify the complete schema.name
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  4. #4
    Join Date
    Mar 2009
    Posts
    6
    Hard coding is not possible. The file may reside in any number of different libraries, depending on the site that the account exists in. I am going to guess that I have to go another route, a stored procedure possibly? I also read that the Zend tools do allow this; the i5_ equivalents of db2_, but I dont want to go back and forth between the two (seems like db2_ tools are eaiser to use).

    Thanks for the response...
    -tdavis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •