WebSphere interview question · Most asked

How do you configure a JDBC data source and connection pool in Liberty and in traditional WAS?

How you'd do it

Members can save this page, take notes and track progress. See membership · Sign in

Summary

In Liberty, add the jdbc feature, a <library> pointing at the driver JAR, and a <dataSource> with a JNDI name, properties and a <connectionManager> for pool settings. In traditional WAS, create a JDBC provider (driver and implementation class), a data source with a JNDI name and a J2C authentication alias for credentials, then tune the connection pool (min/max connections, connection timeout, purge policy) and test the connection.

Longer Answer

<featureManager><feature>jdbc-4.3</feature></featureManager>
<library id="pgLib"><fileset dir="${shared.resource.dir}/jdbc" includes="postgresql-*.jar"/></library>
<dataSource id="ordersDS" jndiName="jdbc/orders">
  <jdbcDriver libraryRef="pgLib"/>
  <properties.postgresql serverName="${db.host}" portNumber="5432" databaseName="orders"
                         user="${db.user}" password="${db.password}"/>
  <connectionManager maxPoolSize="30" minPoolSize="5" connectionTimeout="10s" maxIdleTime="10m"/>
</dataSource>

Size the pool against the database's connection limit across all servers, keep credentials out of the file (environment variables or encoded/secret-backed variables), and set a connection timeout so requests fail fast.

Key Points

  • Liberty: jdbc feature, library, dataSource, connectionManager.
  • Traditional: JDBC provider, data source, J2C alias.
  • Pool size × servers ≤ database limit.
  • Credentials outside the config file.

Explanation

What interviewers look for

Practical configuration on both runtimes and sensible pool sizing.

More WebSphere questions

← All WebSphere questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake