Connect extension to database on different server

Author Message

Pasha Iakhontov

Wednesday 12 November 2008 6:05:55 pm

I have a custom extension that needs to connect to a database on a different server.

I can create a new database connection file based on ezdb.php and just modify it to grab the settings from the extensions site.ini, but the problem I have is that all my classes extend eZPersistentObject and my data type extends eZDataType. Obviously those classes just include the the standard call to eZDB::instance() as well as those classes include other classes.

I am stuck as I don't see a simple way of achieving what I am after.....any help/ideas appreciated!

Łukasz Serwatka

Thursday 13 November 2008 12:31:20 am

Hi,

As fare as I remember this is not possible with standard eZ Publish persistent object. Kristof made a patch while ago which allow connect to extrnal DB with eZ P persistent object.

See http://issues.ez.no/IssueView.php?Id=10667

Patch was made against 3.9 series, thus you will need to clean up it a bit in order to make with work with 4.x

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Piotrek Karaś

Tuesday 17 March 2009 1:36:54 pm

How come hasn't Kristof's patch made it to the regular code?
I guess using some independent connection and abstraction layer would be much safer in this case...

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

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

eZ debug

Timing: Jan 18 2025 18:27:33
Script start
Timing: Jan 18 2025 18:27:33
Module start 'layout'
Timing: Jan 18 2025 18:27:33
Module start 'content'
Timing: Jan 18 2025 18:27:33
Module end 'content'
Timing: Jan 18 2025 18:27:33
Script end

Main resources:

Total runtime0.0148 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.0469152.6406
Module start 'layout' 0.00520.0026 740.687539.4922
Module start 'content' 0.00780.0048 780.179789.3672
Module end 'content' 0.01260.0021 869.546934.3047
Script end 0.0147  903.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002718.5873140.0002
Check MTime0.00128.0269140.0001
Mysql Total
Database connection0.00106.653510.0010
Mysqli_queries0.002114.159130.0007
Looping result0.00000.080710.0000
Template Total0.001812.210.0018
Template load0.00117.575010.0011
Template processing0.00074.562110.0007
Override
Cache load0.00096.072610.0009
General
dbfile0.00042.386880.0000
String conversion0.00000.040340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs