You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Cíntia <ci...@infoeducacional.com.br> on 2007/11/27 15:10:48 UTC
Queries in two differents databases ( connections)
Hi,
I need do a query in two tables of differents databases, this is
possible? I can do this in java or just using SQL?
Thanks,
Cíntia Nogueira
Re: Queries in two differents databases ( connections)
Posted by Rick Hillegas <Ri...@Sun.COM>.
Hi Cíntia,
Derby does not have any builtin support for distributed joins--that is
for running a query which mentions tables in two different databases.
However, you may be able to accomplish what you need to do by using
table functions, a feature that is implemented in the development trunk
and which we expect to expose in Derby 10.4 next year. Table functions
are described in the "Programming Derby-style table functions" section
of the Derby Developer's Guide:
http://db.apache.org/derby/docs/dev/devguide/ Examples of how to use
table functions (including how to write a table function which wraps a
table in another database) can be found in the demo code in the
development trunk at java/demo/vtis--just start with the README file there.
Using table functions, you could fake a distributed join with syntax
like this:
SELECT *
FROM localTable, TABLE( foreignTableFunction() ) foreignTable
WHERE localTable.keyCol = foreignTable.keyCol
Hope this helps,
-Rick
Cíntia wrote:
> Hi,
>
> I need do a query in two tables of differents databases, this is
> possible? I can do this in java or just using SQL?
>
> Thanks,
>
> Cíntia Nogueira
>
>