the way to query tables on database "B" when you are sitting on database "A" is by creating a DBLink on database "A" pointing to database "B".