MySQL Database Connection To Hybris
SAP Hybris Commerce gives great flexibility, allowing you to choose a database best suited to your solution. Below are few recomanded DB’s.
- HSQL DB – Default out-of-the-box solution
- Microsoft SQL Server
In this blog we will see how to install MySQLDB.
SAP Hybris by default comes with HSQLDB and its configuration can be find in project.properties file in Platform directory.
If you search with MySQL in the same file, you will find details to be configured for MySQL database connection.
As you can see MySQL configuration commeted out.
In order use MySQL DB do we need to make the changes in project.property file of platform directory?
The answer is NO, We should not touch any of the extensions provided by Hybris. The reason is during upgrade all your custom data will get overwrite with standard Hybris data.
So then where do we need to make changes?
Hybris has provided one more file local.properties in Config directory. All your custom config changed should be done here and its unaffected during upgrades.
Since we are going to use the same keys with different values, the highest precedence always goes to local.properties file first and hence MySQL DB will be connected rather than HSQL DB.
If we don’t define any DB related configuration inside local.porperties file then HSQL DB configuration inside platform’s project.properties file will be considered and HSQL DB will be connected.
So lets start..
First we need to install the MySQL. Follow the below link. Video demonstrated with older version, but when your installing use the latest version.
Click here: How To Install Latest MySQL Server
Default root user created. But some time this ID cause issue, so we create new user and connection.
Login with root user and navigate to Users and Privilages.
Create new user of your choice.
Click on Administrative Roles tab and select all the checkbox and click on apply .
Click on home and create new connection and give the user id created(Uteg and its Password).
Click on Test Connection.
Login to new conneciton created and Create New Schema.
Now goto to Config directory and add the below details in local.properties in and save. Make sure whatever the user created above, same details you must use here.
After all this step , I did initialize but I faced below error:
nested exception is java.sql.BatchUpdateException: Table ‘rolling.cxresults’ doesn’t exist]
[java] shutting down hybris registry..
[java] at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:97)
[java] at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102)
[java] at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
[java] at bsh.BSHBlock.evalBlock(BSHBlock.java:130)
[java] at bsh.BSHBlock.eval(BSHBlock.java:80)
[java] at bsh.BSHBlock.eval(BSHBlock.java:46)
[java] at bsh.BSHTryStatement.eval(BSHTryStatement.java:86)
[java] at bsh.Interpreter.eval(Interpreter.java:645)
[java] at bsh.Interpreter.eval(Interpreter.java:739)
[java] at bsh.Interpreter.eval(Interpreter.java:728)
[java] at de.hybris.platform.util.ClientExecuter.execute(ClientExecuter.java:49)
[java] … 6 more
Thanks for your help.