TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Garner
from: Edward Lipson
date: 1996-06-16 07:17:00
subject: Binding to 2 Databases

My understanding of how these relational databases work is that you can 
connect to only one at a time. You can't even precompile for two databases, as
the database is specified on the prep command line. You will have to 
precompile twice and have two executables.

This is theory, as I haven't done much with DB2/2 or SQLAnywhere/OS2 other 
than REXX. Actually, I think I'm wrong about the precompile. I've got a copy 
of Compuware's DataXpert for DB2/2, and it just needs a bind for each database
you want to access. maybe the database name isn't in the BND file afterall. 
They must be using some static SQL to access the SYSIBM tables to find out 
what to edit. Could be all dynamic too.

I would modify the process to cut transaction records from the ACTIVE and then
apply them to the HISTORY. I think you can CONNECT to A, CONNECT to H, 
RECONNECT to A, RECONNECT to B, .... and not have to create files, but it 
would be more efficient to CONNECT as few times as possible.

Does the DBMS support three-part names, where the first part is the DB name? I
know this is possible in Sybase. Not sure about DB2/2 (I'm stuck on version 
1.2). If you can use three-part names, you should be OK.

Sorry for the rambling answer.

PG>     I am having a problem running an application against two
PG> different databases.  Let's call one ACTIVE and one HISTORY.  They
PG> have identical structures.  We have an End Of Day process (an EXE
PG> file) gets a Database name (either ACTIVE or HISTORY) from the
PG> user and then connects to that database and runs some inserts,
PG> updates and deletes.  Nothing special there.  The SQL routines are
PG> in 2 files, SQLFCNS.SQX and DB2FCNS.SQX (Yes we need to use C++).
PG> I can only seem to bind to one database at a time.  How can I
PG> precompile/prepare/bind the application so that it can access
PG> either database?  Or better yet how can I precompile/prepare/bind
PG> the SQX files so that they can access both databases?
 

Edward (Ed) Lipson RIME: MOONDOG/#35 [Sat 15-Jun-96 09:10] CIS 74512,3372
Internet edward.lipson{at}moondog.com ELIPSON{at}EMAIL.BONY.COM EdLipson{at}juno.com 

 * CCITT- Can't Conceive Intelligent Thoughts Today
---
 þ RoseRdr/2  1.00á P004360
* Origin: MoonDog BBS-Bklyn,NY-(718)692-2498 (1:278/230)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1
@PATH: 278/230 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.