cakephp dan oracle database???
15 replies [Last post]
Usaha ke arah cakephp
User offline. Last seen 40 weeks 1 day ago. Offline
Joined: 04/24/2010
Points: 104

Kepada otai-otai cakephp sekalian..

Saya sudah lama menghadapi masalah ini. masalahnya iaitu menggunakan cakephp dengan oracle database.

Saya pengguna baru dalam cakephp dan baru nak berjinak-jinak dengan cakephp. Tetapi di tempat kerja saya menggunakan oracle database. Saya fikir, elok saya terus belajar cakephp dengan oracle database.

Tapi sampai sekarang saya masih tidak dapat menyelesaikan masalah menghubungkan cakephp dengan oracle database.

Oracle database yang digunakan ada di server, bukan dikomputer saya dan di komputer saya, saya telah pun install oracle client.

Kepada otai-otai sekalian, ada sebarang pendapat atau cara untuk menyelesaikan masalah saya???

does not have a status.
User offline. Last seen 4 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524

connection php dengan oracle dah jalan? jangan terus dengan cake. buat satu page php biasa test connection php dengan oracle dulu.

Usaha ke arah cakephp
User offline. Last seen 40 weeks 1 day ago. Offline
Joined: 04/24/2010
Points: 104

Dah banyak sistem yang saya da bangunkan dengan php oracle.. Memang tak de masalah... Cume dengan cake je ada masalah sikit.. Still tak dapat connection.. Blh otai tolong bg cara2 penyelesaian.. Saya nak sgt try buat system gune cakephp..

does not have a status.
User offline. Last seen 4 weeks 1 day ago. Offline
Moderator
Joined: 08/16/2009
Points: 1524
Usaha ke arah cakephp
User offline. Last seen 40 weeks 1 day ago. Offline
Joined: 04/24/2010
Points: 104

dah cuba... tapi still tak menjadi..

mcm ni.. contohnya oracle database tu ada kt server.. contoh ip server tu 192.168.90.27 dan 192.168.90.26 (alamat ip hanya sekadar contoh sahaja)..
kat sini.. kalau nk connect ke oracle database.. kene connect dengan kedua-dua alamat ip tersebut..

yang kt web yg kamu bagi tu saya dah cuba buat.. saya buat macam ini.. :-

var $default = array('driver' => 'oracle',
'connect' => 'oci_connect',
'host' => '192.168.90.27,192.168.90.26',
'login' => 'secret',
'password' => 'secret',
'database' => 'secret',
'prefix' => '');

bila saya refresh page.. dekat page die ada bagi tahu yg dah berjaya connect ke database.. tp masalahnya, page tu tak de css.. maksud saya ialah tak de template cake.. die keluar page putih n tulisan hitam je..

any idea?

keje :)
zam3858's picture
User offline. Last seen 21 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

tu takde kaitan dengan oracle pun. cake tak tipu bila dia kata dah ada connection tu.

problem tu mod_rewrite tak on kan lagi kat pc tu. ataupun dia tak configure betul2.

pg kat httpd.conf, cari mod_rewrite and buat comment kat statement load module mod_rewrite tu. restart server then tengok ok ke idak.

kalo tak jalan lagi jugak, check phpinfo n tengok mod_rewrite tu ada ke tak. kalo ada then bukak lagi httpd.conf, cari setting untuk folder document root tu, make sure allowOveride all. bukan allowOveride none.

Usaha ke arah cakephp
User offline. Last seen 40 weeks 1 day ago. Offline
Joined: 04/24/2010
Points: 104

saya cuba....

Usaha ke arah cakephp
User offline. Last seen 40 weeks 1 day ago. Offline
Joined: 04/24/2010
Points: 104

sekarang saya cube connect cakephp ke odbc..
var $default = array('driver' => 'odbc',
'connect' => 'odbc_connect',
'host' => 'localhost',
'login' => 'myschema',
'password' => 'mypassword',
'database' => 'sd',
'prefix' => '')

saya punya my tnsname.ora (dah install oracle client dalam komputer)
SD= (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.18.1.7)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sd)
)
)

My ODBC:
Datasource Name: SD
TNS Name: SD

bile test kt http://localhost/cake/

die keluar ni...
------------
Your database configuration file is present.
Cake is able to connect to the database.
-----------

saya ingat sume dah ok.. tapi bile saya create appmodel contohnya : student.php

<?php
class Student extends AppModel
{
    var
$name = 'student';
    var
$useTable = 'um_student_profile';// contoh sahaja

}
?>

dan controller: students_controller.php

<?php
class StudentsController extends AppController {
    var
$name = 'students';
    function
index()
    {
    }
}
?>

saya cuba bukak : http://localhost/cake/students/

dia keluar error ni .
-------------------------------------------------------------------------
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at C:\xampp\htdocs
\cake\app\controllers\sjs_controller.php:10) in C:\xampp\htdocs\cake
\cake\libs\session.php on line 154

...

and
Warning: odbc_exec() [function.odbc-exec]: SQL error: [Oracle][ODBC]
[Ora]ORA-00933: SQL command not properly ended , SQL state S1000 in
SQLExecDirect in C:\xampp\htdocs\cake\cake\libs\model\dbo\dbo_odbc.php
on line 179

Warning: odbc_num_fields(): supplied argument is not a valid ODBC
result resource in C:\xampp\htdocs\cake\cake\libs\model\dbo
\dbo_odbc.php on line 181

Ape perlu saya buat lagi?

terima kasih...

keje :)
zam3858's picture
User offline. Last seen 21 weeks 6 days ago. Offline
Moderator
Joined: 04/26/2003
Points: 382

apa ada kat line 10 sjs_controller.php?

Usaha ke arah cakephp
User offline. Last seen 40 weeks 1 day ago. Offline
Joined: 04/24/2010
Points: 104

tak de ape. sama ja macam kod student.php.

sebenarnya yang Your database configuration file is present. Cake is able to connect to the database. Memang ada. tapi tanpa template cake. page without css.

Erm runsing....

i'm simple
User offline. Last seen 1 year 19 weeks ago. Offline
Joined: 08/16/2009
Points: 22

sepatutnya xde masalah............

sy dah try ok je xde error...

ni sample sy wat connection dgn oracle... guna scaffolding terus ok..

<?php
class DATABASE_CONFIG {

    var
$default = array(
       
'driver' => 'oracle',
       
'persistent' => false,
       
'host' => 'jdbc:oracle:thin:@localhost:1521:xe',
       
'login' => 'username',
       
'password' => 'password',
       
'database' => 'xe',
    );
}
?>
CakePHP Trainer
User offline. Last seen 2 years 15 weeks ago. Offline
Joined: 01/27/2003
Points: 408

itu masalah htaccess tak parse, dalam config/core.php cuba ubah ayat berkaitan dengan .htaccess disabled. Kena hidupkan something

p/s : aku skrg tgh buat server yg takder .htaccess support

fuelPHP....
echo_php05's picture
User offline. Last seen 1 year 19 weeks ago. Offline
Joined: 08/16/2009
Points: 151

neoryzer wrote:

sepatutnya xde masalah............

sy dah try ok je xde error...

ni sample sy wat connection dgn oracle... guna scaffolding terus ok..

<?php
class DATABASE_CONFIG {

    var
$default = array(
       
'driver' => 'oracle',
       
'persistent' => false,
       
'host' => 'jdbc:oracle:thin:@localhost:1521:xe',
       
'login' => 'username',
       
'password' => 'password',
       
'database' => 'xe',
    );
}
?>


hebat demo...hehehehe...sapo ajor demo...kekekek

I'm noob
hymns's picture
User offline. Last seen 2 years 3 weeks ago. Offline
Pro
Joined: 08/16/2009
Points: 975

echo_php05 wrote:
neoryzer wrote:

sepatutnya xde masalah............

sy dah try ok je xde error...

ni sample sy wat connection dgn oracle... guna scaffolding terus ok..

<?php
class DATABASE_CONFIG {

    var
$default = array(
       
'driver' => 'oracle',
       
'persistent' => false,
       
'host' => 'jdbc:oracle:thin:@localhost:1521:xe',
       
'login' => 'username',
       
'password' => 'password',
       
'database' => 'xe',
    );
}
?>

hebat demo...hehehehe...sapo ajor demo...kekekek

banyakkan membaca. tu je tip dia Tongue

i'm simple
User offline. Last seen 1 year 19 weeks ago. Offline
Joined: 08/16/2009
Points: 22

echo_php05 wrote:
neoryzer wrote:

sepatutnya xde masalah............

sy dah try ok je xde error...

ni sample sy wat connection dgn oracle... guna scaffolding terus ok..

<?php
class DATABASE_CONFIG {

    var
$default = array(
       
'driver' => 'oracle',
       
'persistent' => false,
       
'host' => 'jdbc:oracle:thin:@localhost:1521:xe',
       
'login' => 'username',
       
'password' => 'password',
       
'database' => 'xe',
    );
}
?>

hebat demo...hehehehe...sapo ajor demo...kekekek

org yang bertanya lebih tahu he3.... thanks Smile... ni sifoo aku he3...

I'm noob
hymns's picture
User offline. Last seen 2 years 3 weeks ago. Offline
Pro
Joined: 08/16/2009
Points: 975

neoryzer wrote:
echo_php05 wrote:
neoryzer wrote:

sepatutnya xde masalah............

sy dah try ok je xde error...

ni sample sy wat connection dgn oracle... guna scaffolding terus ok..

<?php
class DATABASE_CONFIG {

    var
$default = array(
       
'driver' => 'oracle',
       
'persistent' => false,
       
'host' => 'jdbc:oracle:thin:@localhost:1521:xe',
       
'login' => 'username',
       
'password' => 'password',
       
'database' => 'xe',
    );
}
?>

hebat demo...hehehehe...sapo ajor demo...kekekek

org yang bertanya lebih tahu he3.... thanks Smile... ni sifoo aku he3...

konon2 tak tau la tu Tongue