|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
"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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > "Error: connect failed". |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|