Option 1
OK so the boring (and hard) way to do this is to issue separate SQL queries to separate databases, and then write a pile of java to compare the results. That can totally be done, but ouch.
If you need to do this sort of thing on a regular basis, you should use a federated database or virtual database tool. Basically what those tools do is create a virtual "uber database" that contains both of the ones you need to query inside of it. So you can connect to the virtual database and issue SQL queries that go against both DBs.
A simple example is UnityJDBC. If you search around, there are others as well, like VJDBC.
You're then just going to write a single SQL query against both DBs that gives you what you want, which is going to be a left join from Database A Table A to Database B table A.
In UnityJDBC, it might be something like this:
SELECT ID, FName, Lname
FROM Database_A.TableA, Database_B.TableB
LEFT JOIN Database_B.TableB ON Database_A.TableA.ID = Database_B.TableB.ID;
This query isn't that complicated, but it would only be possible because you used a virtual DB layer.
Option 2
Use an Extraction, Translation, and Load tool (like Pentaho Kettle) to pull data from one to another. You can use a GUI application to do this, or you can use their open source java libraries and build it into your application.