::::::::::::::::::::::::http://www.broadleafcommerce.com/docs/core/current/tutorials/getting-started-tutorials/switch-to-mysql-tutorial :::::::::::::::::::::::;
::::::::::::::::::::::::::::::BROADLEAF change database from HSQL to MYSQL::::::::::::::::::::::::::::::::::
create database
create database broadleaf;
and/or(not required)
CREATE USER 'td'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON db1.* TO 'td'@'localhost';
GRANT SELECT ON db2.invoice TO 'td'@'localhost';
GRANT USAGE ON *.* TO 'td'@'localhost' WITH MAX_QUERIES_PER_HOUR 90;
(a)Open the root directory of the DemoSite project pom.xml file, in the<dependencyManagement>Regional add:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
(b)Open and found in the pom.xml in the admin and site folders respectively<dependencies>Regional add:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
(c)Add a database named broadleaf in the MySQL database
(d)Open admin/src/main/webapp/META-INF and site/src/main/webapp/META-INF in context.xml respectively, the content is replaced by the following (database configuration information such as user name and password please according to their own environment change accordingly):
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/web"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"
maxIdle="10"
minIdle="5"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
<Resource name="jdbc/storage"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"
maxIdle="10"
minIdle="5"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
<Resource name="jdbc/secure"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"
maxIdle="10"
minIdle="5"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
</Context>
(e)Open the core/src/main/resources/runtime-properties/common-shared.properties file, the following three
blPU.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.HSQLDialect
Were replaced by:
blPU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
(f)Open the DemoSite build.properties in the root directory, the following contents
ant.hibernate.sql.ddl.dialect=org.hibernate.dialect.HSQLDialect
ant.blPU.url=jdbc:hsqldb:hsql://localhost/broadleaf
ant.blPU.userName=sa
ant.blPU.password=null
ant.blPU.driverClassName=org.hsqldb.jdbcDriver
ant.blSecurePU.url=jdbc:hsqldb:hsql://localhost/broadleaf
ant.blSecurePU.userName=sa
ant.blSecurePU.password=null
ant.blSecurePU.driverClassName=org.hsqldb.jdbcDriver
ant.blCMSStorage.url=jdbc:hsqldb:hsql://localhost/broadleaf
ant.blCMSStorage.userName=sa
ant.blCMSStorage.password=null
ant.blCMSStorage.driverClassName=org.hsqldb.jdbcDriver
According to their configuration changes to database:
ant.hibernate.sql.ddl.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
ant.blPU.url=jdbc:mysql://localhost:3306/broadleaf
ant.blPU.userName=root
ant.blPU.password=123
ant.blPU.driverClassName=com.mysql.jdbc.Driver
ant.blSecurePU.url=jdbc:mysql://localhost:3306/broadleaf
ant.blSecurePU.userName=root
ant.blSecurePU.password=123
ant.blSecurePU.driverClassName=com.mysql.jdbc.Driver
ant.blCMSStorage.url=jdbc:mysql://localhost:3306/broadleaf
ant.blCMSStorage.userName=root
ant.blCMSStorage.password=123
ant.blCMSStorage.driverClassName=com.mysql.jdbc.Driver
g:Change the JNDI resource in jetty-env.xml to match your MySQL installation. (both in site and Admin)
<New id="webDS" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/web</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8</Set>
<Set name="username">root</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
<New id="webSecureDS" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/secure</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8</Set>
<Set name="username">root</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
<New id="webStorageDS" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/storage</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8</Set>
<Set name="username">root</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
refresh and install marvin
finally run the jettly-demo on ant-run.
This database migration is complete.
PLZZZZ note ::u may get the error but database in mysql is created
the error looks like [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_state' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAR_CRIT_OFFER_XREF drop foreign key FK125F58033615A91A
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tar_crit_offer_xref' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAR_CRIT_OFFER_XREF drop foreign key FK125F5803D5F3FAF4
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tar_crit_offer_xref' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAX_DETAIL drop foreign key FKEABE4A4B3E2FC4F9
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tax_detail' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAX_DETAIL drop foreign key FKEABE4A4BC50D449
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tax_detail' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TRANS_ADDITNL_FIELDS drop foreign key FK376DDE4B9E955B1D
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_trans_additnl_fields' doesn't exist
[artifact:mvn] [ WARN] 17:06:37 SolrResourceLoader - Can't find (or read) directory to add to classloader: lib (resolved as: C:\Users\Dheeraj\AppData\Local\Temp\Dheeraj\solrhome\lib).
but check u r data base tables r created.
::::::::::::::::::::::::::::::BROADLEAF change database from HSQL to MYSQL::::::::::::::::::::::::::::::::::
create database
create database broadleaf;
and/or(not required)
CREATE USER 'td'@'localhost' IDENTIFIED BY 'mypass';
GRANT ALL ON db1.* TO 'td'@'localhost';
GRANT SELECT ON db2.invoice TO 'td'@'localhost';
GRANT USAGE ON *.* TO 'td'@'localhost' WITH MAX_QUERIES_PER_HOUR 90;
(a)Open the root directory of the DemoSite project pom.xml file, in the<dependencyManagement>Regional add:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
(b)Open and found in the pom.xml in the admin and site folders respectively<dependencies>Regional add:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
(c)Add a database named broadleaf in the MySQL database
(d)Open admin/src/main/webapp/META-INF and site/src/main/webapp/META-INF in context.xml respectively, the content is replaced by the following (database configuration information such as user name and password please according to their own environment change accordingly):
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/web"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"
maxIdle="10"
minIdle="5"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
<Resource name="jdbc/storage"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"
maxIdle="10"
minIdle="5"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
<Resource name="jdbc/secure"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
timeBetweenEvictionRunsMillis="30000"
maxActive="15"
maxIdle="10"
minIdle="5"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/broadleaf"/>
</Context>
(e)Open the core/src/main/resources/runtime-properties/common-shared.properties file, the following three
blPU.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.HSQLDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.HSQLDialect
Were replaced by:
blPU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blSecurePU.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
blCMSStorage.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
(f)Open the DemoSite build.properties in the root directory, the following contents
ant.hibernate.sql.ddl.dialect=org.hibernate.dialect.HSQLDialect
ant.blPU.url=jdbc:hsqldb:hsql://localhost/broadleaf
ant.blPU.userName=sa
ant.blPU.password=null
ant.blPU.driverClassName=org.hsqldb.jdbcDriver
ant.blSecurePU.url=jdbc:hsqldb:hsql://localhost/broadleaf
ant.blSecurePU.userName=sa
ant.blSecurePU.password=null
ant.blSecurePU.driverClassName=org.hsqldb.jdbcDriver
ant.blCMSStorage.url=jdbc:hsqldb:hsql://localhost/broadleaf
ant.blCMSStorage.userName=sa
ant.blCMSStorage.password=null
ant.blCMSStorage.driverClassName=org.hsqldb.jdbcDriver
According to their configuration changes to database:
ant.hibernate.sql.ddl.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
ant.blPU.url=jdbc:mysql://localhost:3306/broadleaf
ant.blPU.userName=root
ant.blPU.password=123
ant.blPU.driverClassName=com.mysql.jdbc.Driver
ant.blSecurePU.url=jdbc:mysql://localhost:3306/broadleaf
ant.blSecurePU.userName=root
ant.blSecurePU.password=123
ant.blSecurePU.driverClassName=com.mysql.jdbc.Driver
ant.blCMSStorage.url=jdbc:mysql://localhost:3306/broadleaf
ant.blCMSStorage.userName=root
ant.blCMSStorage.password=123
ant.blCMSStorage.driverClassName=com.mysql.jdbc.Driver
g:Change the JNDI resource in jetty-env.xml to match your MySQL installation. (both in site and Admin)
<New id="webDS" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/web</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8</Set>
<Set name="username">root</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
<New id="webSecureDS" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/secure</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8</Set>
<Set name="username">root</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
<New id="webStorageDS" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/storage</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
<Set name="url">jdbc:mysql://localhost:3306/broadleaf?useUnicode=true&characterEncoding=utf8</Set>
<Set name="username">root</Set>
<Set name="password"></Set>
</New>
</Arg>
</New>
refresh and install marvin
finally run the jettly-demo on ant-run.
This database migration is complete.
PLZZZZ note ::u may get the error but database in mysql is created
the error looks like [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_state' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAR_CRIT_OFFER_XREF drop foreign key FK125F58033615A91A
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tar_crit_offer_xref' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAR_CRIT_OFFER_XREF drop foreign key FK125F5803D5F3FAF4
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tar_crit_offer_xref' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAX_DETAIL drop foreign key FKEABE4A4B3E2FC4F9
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tax_detail' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TAX_DETAIL drop foreign key FKEABE4A4BC50D449
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_tax_detail' doesn't exist
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - HHH000389: Unsuccessful: alter table BLC_TRANS_ADDITNL_FIELDS drop foreign key FK376DDE4B9E955B1D
[artifact:mvn] [ERROR] 16:56:07 SchemaExport - Table 'broadleaf.blc_trans_additnl_fields' doesn't exist
[artifact:mvn] [ WARN] 17:06:37 SolrResourceLoader - Can't find (or read) directory to add to classloader: lib (resolved as: C:\Users\Dheeraj\AppData\Local\Temp\Dheeraj\solrhome\lib).
but check u r data base tables r created.