Results 1 to 4 of 4

Thread: DB2 + PHP Erro

  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Red face Unanswered: DB2 + PHP Erro

    I need a help, I am creating an application with PHP and DB2 but I'm getting an error I do not understand.
    Could you help me?

    Resultado da página
    Code:
    connecting to DB2...Connected!
    
    Error: [IBM][CLI Driver][DB2] SQL0904N Execução mal-sucedida causada por um recurso indisponível. Código de razão: "UPDATABLE WORKFILE", tipo de recurso: "100" e nome de recurso: "TEMP DATABASE ". SQLSTATE=57011 
    
    SQL: SELECT * FROM DATAW.RESUMO_SLA

    PHP Code:

    <?php 

    class DB2

     var 
    $handle
      
     
    // bool connect(string $dsn, string $user, stirng $pass) 
     
    function connect($dsn$user$pass
     { 
       
    $this->handle odbc_connect($dsn$user$pass); 
       if (!
    $this->handle
         return 
    false
       return 
    true
     } 
      
     
    // resourceid query(string $sql) 
     
    function query($sql
     { 
       
    $rs = @odbc_exec($this->handle$sql); 
           if (
    $rs
             { 
    return 
    $rs
           } 
             else 
           { 
    $sErr "<b>Error:</b> " $this->getErrorMsgs() . "<br><br>\n"
    $sErr .= "<b>SQL:</b> " $sql
    die(
    $sErr); 

     } 

     
    // string getErrorMsgs() 
    function getErrorMsgs() 

    return 
    odbc_errormsg($this->handle); 


    // void disconnect() 
     
    function disconnect() 
     { 
       if (
    $this->handle
         
    odbc_close($this->handle); 
     } 


    ?>



    <?php 

    //require_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] . "/path/to/class.php"); 

    $db = new DB2(); 
    print 
    "connecting to DB2..."
    if (!
    $db->connect("DB9A""******""******")) 

     print 
    "Error!\n"
     exit(); 

    print 
    "Connected!<br>\n"

    $sql "SELECT * FROM DATAW.RESUMO_SLA"
    $db->query($sql); 


    print 
    "Disconnecting..."
    $db->disconnect(); 
    print 
    "Disconnected!<br>\n"

    ?>
    Helpppppp !!!!!!!

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    The error SQL0904 is for "unavailable resources". Have a look at the long error text with an explanation and user response. Commenting any futher on this is hard for me because you choose to not tell us your DB2 version and platform.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Mar 2009
    Posts
    2

    Red face DB2 + PHP Error

    Stolze,
    Here the data of the versions of DB2:

    Version DB2

    DB2 Client: IBM(R) DB2 Universal Database(TM) version 8.2 (version 8.1 FixPak 7)

    DB2 Server: DB2 OS/390 7.1.1

    Test the connection by the DB2

    Code:
    Standard connection tested successfully.
    Database Connection Information
    Database server        = DB2 OS/390 7.1.1
    SQL authorization ID   = (my user)
    Local database alias   = DB9A
    CLI connection tested successfully.
    ODBC connection tested successfully.
    OLE DB connection tested successfully.
    JDBC connection tested successfully.
    ADO connection tested successfully.
    Also working in IBM (Brazil), if we want to talk to Sametime =) ... is very difficult to find professionals to help with DB2 mainframe environment .... thanks for the help =)...
    You know what is it?
    Thanks

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    The unavailable resource apparently is "TEMP DATABASE".
    Typically, you'll get this error when you want to declare a temporary table (a "declared temporary table") and there is no database on the subsystem which was created with the "AS TEMP" keyword.
    See page 521 of the "SQL Reference" Guide for DB2 v7 (SC26-9944) on how to create such a database. I'll need to do that before your PHP script will work. You'll need CREATEDBA or SYSCTRL authority to do this.
    (See also page 726 of that SQL Reference Guide for the use of DECLARE GLOBAL TEMPORARY TABLE; I don't see it being used explicitly, but most likely it's implicitly executed inside the PHP DB2 module.)
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

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