Forums / General / Connection to DataBase out eZ

Connection to DataBase out eZ

Author Message

Natalia Lillo

Monday 17 October 2005 1:43:18 pm

Hi to everybody

Someone to know how to connect to DataBase out of eZ, for retrieve data of other DataBase for example Oracle 8i or other???
Thanks...

Natalia

Kristof Coomans

Tuesday 18 October 2005 4:17:22 am

First of all, you will need the Oracle database extension. Then you'll need to call the method <i>instance</i> of the class <i>eZDB</i>:

$db =& eZDB::instance( $databaseImplementation, $databaseParameters, $forceNewInstance );

$databaseParameters is an array with these keys (some of them are optional): server, user, password, database, use_slave_server, slave_server, slave_password, slave_database, charset, socket, builtin_encoding, connect_retries, use_persistent_connection and show_errors. Take a look in lib/ezdb/classes/ezdb.php for more information.

Then you can query your database:

$result = $db->query( $sql );

or

$resultArray = $db->arrayQuery( $sql );

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Natalia Lillo

Tuesday 18 October 2005 5:32:14 am

Thanks Kristof for your help...
I going take a look in lib/ezdb/classes/ezdb.php

Cheers.

NATALIA

Natalia Lillo

Tuesday 18 October 2005 6:31:07 am

Hi kristof,
I was read ezdb.php file...but..
How I get extension's Oracle??....
Where I can to install the extension

Natalia ....

Kristof Coomans

Tuesday 18 October 2005 10:52:19 am

You can buy the Oracle database extension from eZ systems:
http://ez.no/products/add_ons/ez_publish_database_extension

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Rubén Valenzuela

Tuesday 18 October 2005 1:48:41 pm

Hi Kristof,

Can't I connect directly to Oracle without using the extension? Since PHP is Oracle capable what are the cons of doing it that way?

I wan't to create a module which uses an external database...what are my options.

Regards

Natalia Lillo

Tuesday 18 October 2005 1:49:44 pm

OK,
Thanks...

Natalia

Kristof Coomans

Wednesday 19 October 2005 7:12:56 am

Indeed, you can connect to an Oracle database with the PHP Oracle functions. The only con I can imagine is that if you'll ever want to switch to another database, you'll have to rewrite that part of the code.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Rubén Valenzuela

Wednesday 19 October 2005 7:46:50 am

Thanks Kristof.

I think we'll try this option. Since we don't want to move EZ to oracle.

Amer Azzaz

Wednesday 07 December 2005 3:05:46 am

Hi
Please we can to use ezdb() without the ezoracle extensions.
coz I want to retrive data from oracle only and i am not need to transform my DB of ezpublish to oracle DB.
Plz, can you explain the steps to retrive data from oracle using ezdb() ???
Thank you for your help

Björn [email protected]

Wednesday 07 December 2005 4:26:58 am

to Amer

it is not possible since you don't have the ezdb/oracle driver. You need the go the php native way in this case.

http://de2.php.net/manual/en/ref.oracle.php

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Amer Azzaz

Wednesday 07 December 2005 6:30:35 am

Thank you Mr.Björn
In ez I create a module in it, in oracledata.php I create a class, on it I connect to oracle and execute a query and display the data this process execute without the ezoracle extension but but in this class I used a OCIlogon, OCIParse and OCIExecute without ezdb()
Ok the case is how to use ezdb on my module to connect oracle database as a slave DB because I want to keep my MySql DB and want to connect to Oracle DB.
best Regards,
Amer Azzaz
[email protected]

Philip K.

Monday 30 January 2006 9:04:12 am

Hi.

Referring to this thread...
Is there someone who tried this with the free Oracle 10g Database?

For example:
I want to create a site, where you can read details of my friends. These Details are in this Oralce 10g database and it would be very useful, if I could read these details out of my Oracle Database, so that I don't have to create all these details again in eZ...

Linux is like a wigwam; no windows, now gates, and apache inside!