I have application running in Websphere Liberty and uses DB2 in Z/oS. I have set the db2 driver proerties in DB2JCCConfiguration.properties .How can make sure that the server has picked up properties I have set .I am not sure how to verify the trace to see if the properties are applied to server
Asked
Active
Viewed 705 times
1 Answers
1
To configure a datasource (for any backend DB) with Liberty, you can add configuration like this to your server.xml:
<featureManager>
<feature>jdbc-4.2</feature>
</featureManager>
<library id="driver-library">
<fileset dir="/path/to/driver/dir" includes="*.jar"/>
</library>
<dataSource id="DefaultDataSource" jndiName="jdbc/myDB">
<jdbcDriver libraryRef="driver-library"/>
<properties.db2.jcc serverName="example.db.hostname.com" portNumber="50000"
databaseName="myDB"
user="exampleUser"
password="examplePassword"
currentSchema="xyz"
fullyMaterializeInputStreams="true"/>
</dataSource>
To test if your configuration is correct and that your Liberty server can connect to your DB2 database, add the following configuration:
<featureManager>
<feature>appSecurity-3.0</feature>
<feature>restConnector-2.0</feature>
<feature>jdbc-4.2</feature>
</featureManager>
<!-- Any security mechanism can be used, <quickStartSecurity> is the simplest -->
<quickStartSecurity userName="admin" userPassword="admin"/>
And then go to: https://localhost:9443/ibm/api/validation/dataSource/DefaultDataSource
(this assumes your <dataSource>
id
is DefaultDataSource
)
For more info, see this cheat sheet: https://aguibert.github.io/openliberty-cheat-sheet/#_ibm_db2

Andy Guibert
- 41,446
- 8
- 38
- 61
-
Hi I don't want to have datasource in my liberty sever I just need to set the properties for the driver .I know in websphere server we set the variables like fullyMaterializeInputStreams and currentSchema via admin console but in liberty how to set the values – user2462959 May 08 '20 at 04:38
-
1why don't you want to have the datasource in the liberty server.xml? If you create the datasource yourself using a properties file you aren't utilizing the liberty connection pool and don't have proper integration with the transaction manager either, so you would have less functionality and worse performance – Andy Guibert May 08 '20 at 05:47
-
you can still set properties such as `fullyMaterializeInputStreams` and `currentSchema` using a server.xml datasource -- I updated my answer to show how that is done – Andy Guibert May 08 '20 at 05:49