2008年7月21日星期一

Re: [fw-db] Error with PDO_OCI (Invalid handle)

This usually happens when apache dosen't have the ORACLE_HOME variable setup properly       setup a  test php file with  <? phpinfo(); ?>  and  check if you see ORACLE_HOME setup.


this is what I have on  /etc/sysconfig/httpd   

export ORACLE_HOME=/u01/app/oracle/
product/10g_client
export ORACLE_SID=10g_client
export TNS_ADMIN=/u01/app/oracle/product/10g_client/network/admin/tnsnames.ora


and works fine,   (RedHat ES 5)


On Tue, Jun 17, 2008 at 4:50 AM, jeromekbe <j.kaluza@redcross-transfusion.be> wrote:

i have tried and still got OCI_INVALID_HANDLE for pdo_oci and unknow
exception with Zend DB Oracle Adapter


I don't know what would be wrong in my setup, an old php app can connect to
the database using adodb for php (using oci8)





jeromekbe wrote:
>
> web02prd is the Oracle SID, apache php and oracle database are on the same
> host
>
> Duncan, Craig wrote:
>>
>> I do not see your Oracle SID, in your connection params, try something
>> like
>>
>> 'dbname'      => 'web02prd' . '/' . $oracle_sid,
>>
>> If you are unsure what that is, open up a shell on your Oracle server
>> and look for the environment variable ORACLE_SID.
>>
>> Craig Duncan
>> -----Original Message-----
>> From: jeromekbe [mailto:j.kaluza@redcross-transfusion.be]
>> Sent: Monday, June 16, 2008 8:02 AM
>> To: fw-db@lists.zend.com
>> Subject: Re: [fw-db] Error with PDO_OCI (Invalid handle)
>>
>>
>>
>>
>> jeromekbe wrote:
>>>
>>> Hi everyone, i am having an issue with PDO_OCI and eventhough i have
>> been
>>> posting on several forums, oracle otn included, i still cannot have
>> any
>>> answer, so i would like to know if any of you got the same error and
>> how
>>> to solve it.
>>>
>>> My situation is a Linux server, with apache 2 and php5.2.5 and also
>> the
>>> Oracle database.
>>>
>>> While trying to create my hand thru the factory method, i get this
>> error
>>> message :
>>>
>>> SQLSTATE[]: pdo_oci_handle_factory: OCI_INVALID_HANDLE
>>>
>>> my code for connecting to database is :
>>>
>>> public static function setDb(){
>>>             $options = array ( Zend_Db::CASE_FOLDING =>
>> Zend_Db::CASE_UPPER);
>>>             $params = array (
>>>                                     'username' => 'myuser',
>>>                                      'password' => 'mypass',
>>>                                      'dbname'      => 'web02prd',
>>>                                      'options'  => $options);
>>>
>>>             try{
>>>                     $db = Zend_Db::factory("PDO_OCI",$params);
>>>                     $db->getConnection();
>>>                     return $db;
>>>             }catch(Zend_Db_Adapter_Exception $e){
>>>                     echo $e->getMessage();
>>>                     Zend_Debug::dump($db);
>>>             }
>>>     }
>>>
>>> Note that oci8 work properly,
>>>
>>>
>>
>>
>> I tried to specify the host and port but it's still the same error, when
>> i
>> try the Zend_Db adapter Oracle to use oci8 but i get the message
>> "Unknown
>> Exception", if i use oci8 in a test file it's working, if i use PDO
>> functions i will have message OCI_INVALID_HANDLE, does that mean i need
>> to
>> rewrite all my DAO classes and a connecting class with oci functions
>> instead
>> of using Zend Db ?
>> --
>> View this message in context:
>> http://www.nabble.com/Error-with-PDO_OCI-%28Invalid-handle%29-tp17819374
>> p17863079.html
>> Sent from the Zend DB mailing list archive at Nabble.com.
>>
>>
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Error-with-PDO_OCI-%28Invalid-handle%29-tp17819374p17881563.html
Sent from the Zend DB mailing list archive at Nabble.com.


没有评论: