Multiple databases in one application, howto select the desired datasource?

We’ve application with more then one datasource/datastores, which means we have different database connections.

We want to implement as Service which will use the QueryRunner to get some ResulSets of a specific datasource.

How can we access/specify the datasource programmatic?

Use Persistence.getDataSource(String storeName) method.
Or create a transaction using Persistence.createTransaction(String storeName), and obtain a Connection using Persistence.getEntityManager().getConnection(). It will be the connection to your specific database.