To configure a JDBC pool for Microsoft SQLServer in Tomcat 9 I've added below to server.xml
<Resource auth="Container"
type="javax.sql.DataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/SABA"
defaultAutoCommit="true"
username="user" password="pass" url="jdbc:sqlserver://myserver:1433;DatabaseName=mydb;" />
During tomcat startup I get lots of ClassNotFoundException
Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
This is obviously normal as I did not copy the SQL Server drivers into Tomcat libs, but after application startup, the pool is working and I can get connection from it. I have the SQL Server drivers in my application WEB-INF\lib
.
Is it a default behavior? If this is normal, can I suppress the exception during Tomcat startup?