Search code examples
javajakarta-eewebsphere-libertyopen-libertyjava-ee-8

Does OpenLiberty 18.0.0.2 come with an embedded database like Derby DB or H2?


I can't find any documentation about an embedded database within OpenLiberty 18.0.0.2 like Payara or Wildfly. Is there an embedded database shipped with OpenLiberty per default or do I have to configure a H2 or Derby DB by myself?

Right now I am configuring a Derby DB like the following:

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
  <featureManager>
    <feature>javaee-8.0</feature>
  </featureManager>
  <quickStartSecurity userName="admin" userPassword="adminpwd" />

  <httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443" />

  <applicationManager autoExpand="true" />
  <applicationMonitor updateTrigger="mbean" />
      <dataSource id="DefaultDataSource">
    <jdbcDriver libraryRef="MyJDBCLib" />
    <properties.derby.embedded databaseName="myDB" createDatabase="create" />
    <containerAuthData user="user1" password="{xor}Oz0vKDtu" />
  </dataSource>
  <library id="MyJDBCLib">
    <file name="/Users/Philip/Tools/openliberty/wlp-18.0.0.2/lib/derby.jar" />
  </library>
</server>

Is this the right/common approach for OpenLiberty?


Solution

  • Open Liberty does not contain an embedded database. Your config is the right approach to configure a DefaultDataSource with Derby.

    As a side note, the wlp/usr/lib directory is intended for product libraries, not user libraries. A more appropriate location is in wlp/usr/shared/resources.