0

I have two Java applications on a server run by Tomcat 8.5 with two WAR files. These two Java applications must connect to a database. I use the file sqljdbc_auth.dll so that it can connect automatically with JDBC.

Putting the command -Djava.library.path=C:\JDBC in Tomcat Java option, but the database access doesn't work with the two WARs at the same time and I don't know why.

Any solution to solve the problem and make my two WARs able to connect to db at the same time? I tried to deactivate one of the WARs so that db access works for the other WAR.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
arnaud92
  • 1
  • 1
  • 1
    IIRC, the problem has to do with the DLL getting loaded from two classloaders. Possibly, putting the driver itself in the Tomcat `lib` folder (and removing it from the WAR) might be sufficient. Possibly you may even have to define the data source(s) in the server.xml, and look up the data source through JNDI in the individual WARs, instead of configuring this per WAR. – Mark Rotteveel Oct 27 '22 at 14:16
  • 1
    I don't see any reason why you can't use an all-Java solution for this problem. No good reason for a DLL. Give each WAR its own type IV JDBC driver and a connection pool with auth parameters. Better be very thoughtful about isolation and transactions. – duffymo Oct 27 '22 at 15:15
  • I have put the dll in the bin folder of Tomcat but it doesnt change anything. SQL access are not shared between multiple wars – arnaud92 Oct 28 '22 at 15:04

0 Answers0