Chris,
Marking as OP since this is really a question about databases.
On 1/11/21 14:15, Chris Cheshire wrote:
On Jan 11, 2021, at 1:19 PM, Jerry Malcolm <techst...@malcolms.com> wrote:
I have a query that needs to access tables in two different databases on the
same mysql instance. I see how that can be done with the JOIN syntax in mysql.
But datasource pools reference a single database, correct? I really need to
'join' two datasources for one sql call. I found info on doing this by
embedding TC in the Spring framework. But I was hoping to not have to do a
major restructuring. Is there a way to get a connection that attaches to two
separate databases?
If the databases are on the same MySQL instance, just adjust the
grants for the user to be able to access tables in both datasources.
+1
You will have to fully-qualify the table references in your queries like
this:
SELECT lt.foo, rt.bar
FROM local_table lt
JOIN other_db.remote_table rt ON lt.fk=rt.pk
;
Hope that helps,
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org