If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 + PHP Erro

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-09, 22:48
acm.correa acm.correa is offline
Registered User
 
Join Date: Mar 2009
Posts: 2
Red face 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 !!!!!!!
Reply With Quote
  #2 (permalink)  
Old 03-16-09, 09:24
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #3 (permalink)  
Old 03-21-09, 15:02
acm.correa acm.correa is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 03-21-09, 18:10
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
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/
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On