WebSphere Application Server & Liberty

 View Only

 SQLFeatureNotSupportedException when calling DataSource.setLoginTimeout on Liberty

Yoshiki Yamada's profile image
Yoshiki Yamada posted Thu August 28, 2025 08:29 PM

My code that uses javax.sql.DataSource#setLoginTimeout works on traditional WebSphere Application Server (tWAS), but it fails on Liberty with the following exception:

Caused by: java.sql.SQLFeatureNotSupportedException
	at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.setLoginTimeout(WSJdbcDataSource.java:424)
	at com.ibm._jsp._aa._jspService(_aa.java:98)

It seems to me that liberty doesn't accept timeout value which is different from the one configured as a datasource configuration.
https://github.com/OpenLiberty/open-liberty/blob/integration/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcDataSource.java#L428

Yoshiki Yamada's profile image
Yoshiki Yamada

In Liberty, the timeout is supported only via configuration, not programmatically; if an application tries to set a different value with setLoginTimeout(), Liberty throws SQLFeatureNotSupportedException and this is expected behavior.

To avoid the exception, set the login timeout in server.xml, for example:

<properties.db2.jcc databaseName="***" password="***" portNumber="***" serverName="***" user="***" loginTimeout="50"/>