aspose file tools*
The moose likes JDBC and the fly likes Join between tables in different databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Join between tables in different databases" Watch "Join between tables in different databases" New topic
Author

Join between tables in different databases

Billy Tobon
Greenhorn

Joined: May 11, 2004
Posts: 9
Hi,
I need to make a join between two tables but they are in different databases (in slqserver2000), I found a ".relation" in c#, but want to use JDBC. There is any solution or workaround?

Billy


Compilatum est.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I've done it in plain old SQL in MySQL using schema1.table1.attribute and schema2.table2.attribute, but in the end I found it easier to dump the table and import it into the other schema. All depends on your requirements. I was just doing some fairly basic (once-off) data conversion.

Actually I think from memory the table is still there...
Phillip Koebbe
Greenhorn

Joined: Jun 22, 2005
Posts: 27
In a standard SQL query, it would look something like



As with most of my replies, this is from the hip, but I think it's close. If you are querying with sa or equivalent rights, you don't need the owner, but you still need the dot, so it becomes Database2..t_Table2.

Peace,
Phillip
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Join between tables in different databases