PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Ivor Williams <c4xt-a6o8 at xemaps dot com>
Subject: Using Class::DBI across multiple databases on one server (Sybase)
Date: Aug 23 2005 10:57AM

Note: also posted to classdbi list.

I have an issue where I am needing a transaction to update across multiple databases. I can do this in SQL using the database..table notation. 

I have an existing CDBI suite of classes that use a separate database connection for each database. But this doesn't work with transactions on both connections owing to the way Sybase handles chained transactions. If they were sharing one channel, this would give me what I want.

I have no choice over the fact that the tables are in two different databases. Here is an illustration of what I want to do.

package DB::Connect;
use base qw(Class::DBI);

__PACKAGE__->set_db("dbi:Sybase:server=SYB_PROD;database=SALESDB",$user,$passwd);

package DB::Order;
use base qw(DB::Connect);

__PACKAGE__->set_up_table("ORDER");
__PACKAGE__->has_a( account => 'DB::Account');

package DB::Account;
use base qw(DB::Connect);

__PACKAGE__->set_up_table("REFERENCEDB..ACCOUNT");
...

It seems that table and set_up_table don't support "database.schema.table" syntax unless I am missing something.

Any help would be appreciated.

Ivor.