External database integration

Author Message

ciradhb forward

Monday 21 March 2005 5:00:44 am

Hi,
I think my need is preety simple but I didn't read anything about it in EZPublish documentation.

I have an existing database that stores a lot of scientific data. I need to create EZPublish content classes that integrate on one hand standard attributes like text, URL, email, images, etc , but on the other hand some attributes that should collect their values by a request on the external database.

Conceptually, I would like to have a datatype for these attributes that could allow me to specifify that their value is the result of a SQL request like : "SELECT Field1,Field2,Field3 FROM MyBase::MyTable WHERE Field4=$X"
where $X could be a value that is entered when the content classe is instanciated.

For instance, imagine an ecommerce site that would create pages describing their products and that the price attribute of each product is the result of "SELECT price FROM product WHERE product_ref=$Ref" .

I guess it is a basic feature for a CMS like EzPublish, and maybe there are several ways to do it. But I did not found the solution in EZP docs. Can someone help me ?

Thanks in advance.

HB

Frederik Holljen

Monday 21 March 2005 6:44:47 am

Hi,

This issue depends on a few variables that you do not mention in your request:

- how do you want to control exactly which resource to select from in the external database (by another attribute in the content object?)
- do you want to be able to "edit" the external attributes from eZ publish?
- do you need translation or version control?

If you don't need translation or version control I would suggest to write new datatypes for each of the different type of fields from the external resource (e.g external int, external varchar etc.) use a native eZ publish attribute to control the id of the external content row.

I think some of our partners have developed something like this in the past.

Frederik

ciradhb forward

Monday 21 March 2005 7:50:28 am

Hi Frederik,

In a first step, I only expect to request my database in a static way. I know the table and field names in advance, so I can hardcode them. I only need to allow a contributor to specify a value for the $X variable in the WHERE of the SELECT clause.
Actually, for the moment I only want to know how to send a request to an external database and get the result in a content object. Maybe in a second step, I will want to do it more dynamically and be able to specify more elements of the SELECT clause.
What do you mean by "edit the external attribute" ? To change its value and update the external DB ? Not for the moment, my hope is just to request the external DB, get the result, and integrate this result in a EZP content object. No translation or version control either.

Thanks for your help .

HB

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.