I will work on a small test case and try to share it asap. Thanks for replying
Marco Ferretti | Senior Java Architect | Axiante (https://www.axiante.com) M +39 366 6186339 A Via Paracelso 16, 20864 Agrate Brianza (MB) On Apr 4 2022, at 12:47 pm, Jean-Louis Monteiro <[email protected]> wrote: > Hi > > Can you create a small GitHub project we could look at? > Le lun. 4 avr. 2022 à 10:06, Marco Ferretti <[email protected]> a > écrit : > > > > > Hi all, > > I am trying to connect to two different apache derby schemas via jndi > > lookup. In order to do this I have created two datasources as follows > > (within tomee.xml): > > > > <Resource id="jdbc/aName" type="DataSource"> > > JdbcDriver org.apache.derby.jdbc.ClientDriver > > JdbcUrl jdbc:derby://database:1527/mui;create=false > > UserName user_A > > Password aPassword > > </Resource> > > > > <Resource id="jdbc/anotherName" type="DataSource"> > > JdbcDriver org.apache.derby.jdbc.ClientDriver > > JdbcUrl jdbc:derby://database:1527/mui;create=false > > UserName user_B > > Password anotherPassword > > </Resource> > > > > In my application I have 2 separate ejb with two separate jpa > > configurations, one that looks-up for jdbc/aName another that looks up for > > jdbc/anotherName. > > When I run my application the first jndi that accessed up is > > jdbc/anotherName and everything runs smoothly. When I try to access the > > second jndi I get an error telling me that the user has not access to the > > database. > > In order to narrow down the problem, I have tried the following : > > I have tried to access the two databases with the same credentials from ij > > (concurrently) and everything seems correct > > > > I have tried to create two separate databases, instead of one database > > with two schemas, and everything runs fine within tomee > > > > Could it be that I am missing some configuration and that the lookup fails > > to realize that I am using two different connections ? > > I have tried to read the documentation regarding the JNDI configuration > > but I couldn't find where I am wrong. > > > > Any help would greatly be appreciated > > Marco F. >
