does anyone know how to connect to connect to 2 databases in one session?
e.g.: Select * from DB1.customer inner join DB2.customer
It depends on the database you are using and what you mean with DB1 and DB2. In mysql or sybase for instance you can query tables from different databases in the same sql server. The symtax is likme you did above.
Select * from DB1.customer inner join DB2.customer
Select * from DB1..customer inner join DB2..customer
If you mean different SQL servers with DB1 and DB2 this is not so eays. Oracel has database links to view remote tables. MySql supports federated tables and I think sybase has a remote tables called proxy table.
These all are databse provider specific solutions. AFAIK there is a JDBC driver called CJDBC (clustered JDBC?) which can map tables to different SQL connections on the client side. Perhaps you can try this.