It depends on who controls the data source.
If you manually create and manage a data source in your own webapp, for example new SomeDataSource() , etc., then the JDBC driver JAR file can be placed in webapp /WEB-INF/lib . But if the server application already has the same JDBC driver JAR file in its own /lib , then you can also just use it.
However, if you instruct application servers to independently manage the data source, and you simply use it in your webapp via @Resource , etc., then the JDBC driver JAR file must be placed in your own /lib application server, for the simplest reason, because the data source is ready to run application applications completely independent of any (former) deployed web applications. This data source, in turn, is available for all web applications. This technically just does not work if the JD file of the JDBC driver is in one of the web applications that have not yet been deployed.
source share