PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old May 14th, 2006, 01:42 AM
aanisnaini aanisnaini is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 aanisnaini User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
"Error: connect failed".

Dear All,

I tried some tutorial (beginner) use oracle 10g database. But the result is failed.
my code for connect to database like below:

<?php
require_once ("DB.php");
$user="myuser";
$pass="mypassword";
$host="localhost";
$db_name="xs10";
$dsn="oci8://$user:$pass@$host/$db_name";
$db=DB::connect($dsn,false); // I already try with "true" value also
//echo $dsn;
if(DB::isError($db))
{
die($db->getMessage());
}
?>

the result page always "Error: connect failed".

any way, if i used below code:

<?php
$conn = OCILogon("myuser", "mypassword", "//localhost/xs10");

if (!$conn) {
exit;
}

echo OCIServerVersion($conn) ."<br>n";
print date('Y-m-d H:i:s')."<br><br>n";
?>

the result is successfully, i mean the browser show result:
-------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options 2006-05-13 00:04:15
-------------------------------------------------------
but I don't want use this, I just want use Pear DB.

i tried the same way to connect to mysql, the result is successfully.


<?php
require_once ("DB.php");
$user="myuser";
$pass="mypassword";
$host="localhost";
$db_name="xs10";
$dsn="mysql://$user:$pass@$host/$db_name";
$db=DB::connect($dsn,false);
//echo $dsn;
if(DB::isError($db))
{
die($db->getMessage());
}
?>


please help me.
i need migration (redeveloping) current stable software immediatelly, since my company moving to oracle. i don't want this situation come to me later. that whay i using pear DB to prepare some day change database provider.
I need migration (redeveloping) current stable software immediately, since my company moving to oracle. I don't want this situation come to me later. That why I using pear DB to prepare some day change database provider.
Does some body have article/tutorial/reference or information of book special pear DB and Oracle? I need this for advance programming later on.
Thank You
Best Regard's
Aan Isnaini

Reply With Quote
  #2  
Old May 14th, 2006, 06:00 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: "Error: connect failed".

$dsn = array('phptype' => oci8, 'username' => $user, 'password' => $pass, 'hostspec' => "//$host/$db_name");
$db =& DB::connect($dsn);

that should work ..

alternatively use PEAR::MDB2 ..
note: there you would need to set the "emulate_database" option to false

$dsn = "oci8://$user:$pass@$host/$db_name";
$mdb2 =& MDB2::factory($dsn, array('emulate_database' => false));

regards,
Lukas

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > "Error: connect failed".


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway