• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

heterogeneous select???

 
Jeremiah Elliott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does jdbc support heterogeneous selects? I would like to be able to select from a postgres table with a sub-select out of a db2/400 table. is this even possible using the postgres and IBM drivers???
thanks
-J
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a connection can only be to one database, So you can't query 2 different databases with the same connection.
The possible workaround:
you can work around this at the database end by creating a link from database1 to database2(if database1 supports this feature). I don't know the how to do this ( that's what DBA's are for! )but once it is working, you can query database1 or database2 through the link from database1 from one connection to database1. In our situation, both databases are Oracle, so it works seamlessly. Note that this is invisible to the driver, because it thinks that it is only querying database1. This does require database dependenies and advanced settings though.
this is how it works:
1. tell database1 where database2 is (link)
|database1| --------->|database2|
2. create a connection to database1 using java
connect ----> |database1|
3. query database1:
query ----> |database1|
result <--------|
4. query database2:
query ----> |database1| < - - - > |database2|
result <--------|
Thought the illustration might help me explain things,
Jamie

Jamie
[ October 10, 2002: Message edited by: Jamie Robertson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic