Few weeks ago, I was talking with few developers working on an SAP Commerce implementation. They made a comment that it’s a bit manual process to do the local environment for a developer and the process requires execution of the same steps for each new environment setup.

I was successful explaining them mostly with documentation on how the environment setup can be done quickly with exiting tools available in the product like installer, ant targets, etc, However, I found that there is not enough or clear articulation available on the correct way to setup or automate the database driver library inclusion for an SAP Commerce development or CI/CD environment.

This blog post explains the available options to configure the database driver in an SAP Commerce installation as a one time activity.

Context

SAP Commerce ships database drivers configured by default  for the following databases in the standard SAP Commerce base installation archive:

  • HSQL database
  • Microsoft SQL Server database
  • SAP HANA database

A developer can validate the same:

  • by finding the database driver jar files at:
    <SAP_COMMERCE_HOME>/hybris/bin/platform/lib/dbdriver​
  • by finding the maven dependencies of the database drivers in:
    <SAP_COMMERCE_HOME>/hybris/bin/platform/lib/dbdriver​/external-dependencies.xml

After looking at these, a developer may be trying to find these questions:

  • Why does the database drivers information exist at two places?
  • Does it require to copy the database driver jar file as well as the maven dependency for my database?

In the sections, ahead the document explains available options to configure the database driver for an SAP Commerce installation.

Available options

There are following ways of configuring the database drivers in an SAP Commerce installation.

  • Configure by downloading copying the database driver jar file
  • Configure using maven dependencies

Configuring the database driver manually

SAP Commerce allows to include the external libraries by copying the respective jar files to the extensions where those are trquired. In case of the database driver also the database driver library can be copied to the platform/lib/dbdriver directory.

Note: Doing a change directly in an out of the box extension is not recommended and not a good practice.

So, the right way of configuring the database driver library file to SAP Commerce is by doing it in the following steps:

  1. Create a directory path inside the hybris/config folder as hybris/config/customize/platform/lib/dbdriver
  2. Download the database driver library and copy it to hybris/config/customize/platform/lib/dbdriver
  3. Execute the ant customize command

The database driver library will be automatically copied to the platform/lib/dbdriver directory. Commit this jar file into your version controlled code repository like git. Subsequently on the other systems or environment you would just need to execute only the ant customize command.

Configuring using maven depdendency

SAP Commerce allows to include the external libraries as maven dependencies to the extensions where those are trquired. In case of the database driver also the database driver maven dependency can be defined in the platform/lib/dbdriver/external-dependencies.xml file. Then as part of the build process the library would be downloaded automatically in to platform/lib/dbdriver directory from the maven repository.

Note: Doing a change directly in an out of the box extension is not recommended and not a good practice.

So, the right way of configuring the database driver library file to SAP Commerce is by doing it in the following steps:

  1. Create a directory path inside the hybris/config folder as hybris/config/customize/platform/lib/dbdriver
  2. Copy the external-dependencies.xml file from hybris/bin/platform/lib/dbdriver to hybris/config/customize/platform/lib/dbdriver
  3. Add the maven dependency of your database driver library in the hybris/config/customize/platform/lib/dbdriver/external-dependencies.xml file
  4. Execute the ant customize build command

The database driver library will be automatically copied to the platform/lib/dbdriver directory. Commit this jar file into your version controlled code repository like git. Subsequently on the other systems or environment you would just need to execute only the ant customize command.

Conclusion

This blog post talks about the database driver setup automation only though there are many options to expedite the development and setup processes for an SAP Commerce implementation. We just need to explore, find and use the right options for acceleration.

 

Found this blog post useful? please feel free to like, share, comment and ask question liking to SAP Commerce tag for any further insight.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x