Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-11-2007, 01:26 AM
Junior Member
 
Join Date: Oct 2007
Posts: 1
Default Using two different schemas?

In ZF, is it possible to connect to two different DB schemas?

I'm using Oracle and I have two DB schemas.
Example:
[schema1]
table1(id, column1, column2,...)
table2(id, column1, column2,...)

[schema2]
table1(id, column1, column2,...)
table2(id, column1, column2,...)

Now, I want to run a query like
SELECT *
FROM schema1.table2 t1, schema2.table1 t2
WHERE t1.id = t2.id

or something to that effect. Do I have to modify my config.ini to accommodate for two different DB users?

Like,
[db1]
db.adapter = Oracle
db.config.host = localhost
db.config.username = db1
db.config.password = pass
db.config.dbname = xe

[db2]
db.adapter = Oracle
db.config.host = localhost
db.config.username = db2
db.config.password = pass
db.config.dbname = xe

Can anyone show me how to set this up?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-11-2007, 10:37 AM
Junior Member
 
Join Date: Sep 2007
Posts: 10
Default

Hi.

As i know all you have to do is specify the schema of the table in the definition of the model class.

For example you can have tablea (schema a) and tableb (schema b) all you have to do is:

PHP Code:
class tablea extends Zend_Db_Table_Abstract {
      
$_schema "a";

...

and 

class 
tableb extends Zend_Db_Table_Abstract {
      
$_schema "b";

... 
Hope this helps. For more details check out:
Zend Framework: Documentation

Adrian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:17 PM.