Hi Sumit,
The databases are both microsoft sql. As you say it looks like DBI does not
support what I would like to do when the tables are in different databases.
I will just have to continue what I have right now which is read in from
one, store in a hash and the use the hash keys to query the second database.
the only problem with this is that it ran a little slow and I felt getting
SQL to do this compare would be faster.Thanks any way 
Willie

Willie McSweeney
Memory Component Engineer
EMC,
Ovens, 
Co.Cork, Ireland.
Tel +00353-21-4281412
Fax +00353-21-4281898
Email <[EMAIL PROTECTED] >


> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 01, 2001 4:24 PM
> To:   [EMAIL PROTECTED]
> Subject:      RE: sql table joins
> 
> 
> 
> 
> 
> 
> Hello Willie,
> 
> >If I do something like
> >$dbh = DBI->connect ('dbi:ODBC:TotalBoards', 'user', 'password') or die
> >"could not CONNECT $!";
> >$dbh_aml = DBI->connect ('dbi:ODBC:AML', 'user', 'password') or die
> "could
> >not CONNECT $!";
> >
> >$sth = $dbh->prepare(qq{SELECT TotalBoards.EMC_PN FROM TotalBoards,
> >AMLMaster WHERE TotalBoards.SYMPTOM_CODE LIKE ? AND TotalBoards.EMC_PN =
> >AMLMaster.AMLPN AND TotalBoards.REC_DATE BETWEEN ? AND ?}) or die
> "Couldn't
> >prepare statement: " . $dbh->errstr;
> >
> >I get an error "invalid object name AMLMaster". This is I guess because
> $dbh
> >is the connection to TotalBoards and knows nothing about the AMLMaster
> >table. I have another $dhh_aml connecting to AMLMaster. My question is
> how
> >do you write a prepare statement as above that works. Can you get $dbh to
> >connect to both tables at the same time???
> >Willie
> 
> If I guess it correctly, the table AMLMaster is in the AML Database/DSN
> and
> TotalBoards Database/DSN, right. If so you will have to have a database
> link created between the 'TotalBoards' and 'AML' databases. I don't think
> you can do what you are doing with out a database link or some thing like
> that between 'TotalBoards' and 'AML'. Also i don't think ODBC supports
> such
> a thing.
> 
> What databases are these two? If it's oracle then you can create a
> database
> link using the command 'CREATE DATABASE LINK ...' in SQL Plus.
> 
> Hope this helps.
> 
> Regards,
> 
> Sumit.
> **************************************************************************
> ******************************
> 
> Just because something doesn't do what you planned it to do doesn't mean
> it's useless.
>                                          -Thomas A. Edison
> **************************************************************************
> ******************************
> 

Reply via email to