Connection to Thirdparty Database


#1

Hi,

I need to connect to external third party database other than the Process Engine linked Camunda Database for updating the data into it. How can I configure the connection with this external DB. I am using a wildfly Application Server,which is linked to Camunda DB on MySQL DB server. The third party external DB server is Oracle DB. Kindly advise.

Thanks
Gaga


#2

Hi @Gaga,

How did you link the Camunda engine to the MySQL DB server?
Can’t you do a similar integration to Oracle DB?

In this link, I describe some steps how to connect the engine to PostgreSQL, maybe it helps you :wink:

So, for the “engine” DB, there are already scripts to create the schema into the new external DB server. You run those and then you modify the standalone.xml file accordingly.
In the above link I also describe how to create an “application” database as well.


#3

Thanks Kontrag. I tried the approach of connecting to Two different Databases in one Transaction and was successful.

I am able to connect to the Camunda Process Engine DB i.e.MySQL DB and the data gets updated within the Camunda seeded tables.Also i am able to connect to a Oracle DB by registering a bean for datasource and hence the data gets updated within the table in Oracle DB but the requirement is that the data should also be saved within a custom table in camunda DB and for the same when i try and register a bean so the the JDBC connection can be opened with the MySQL DB i.e. Camunda DB,i get the below error. Can you please help me on the below error. Thanks

used by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘HDBHelperDaoImpl’: Unsatisfied dependency expressed through field ‘hibernateTemplate’: Error creating bean with name ‘hHibernateTemplate’ defined in class path resource [com/wipro/base/fomanagement/AppConfig.class]: Unsatisfied dependency expressed through method ‘getHibernateTemplate1’ parameter 0: Error creating bean with name ‘hSessionFactory’ defined in class path resource [com/wipro/base/fomanagement/AppConfig.class]: Invocation of init method failed; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘hSessionFactory’ defined in class path resource [com/wipro/base/fomanagement/AppConfig.class]: Invocation of init method failed; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘hHibernateTemplate’ defined in class path resource [com/wipro/base/fomanagement/AppConfig.class]: Unsatisfied dependency expressed through method ‘getHibernateTemplate1’ parameter 0: Error creating bean with name ‘hSessionFactory’ defined in class path resource [com/wipro/base/fomanagement/AppConfig.class]: Invocation of init method failed; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘hSessionFactory’ defined in class path resource [com/wipro/base/fomanagement/AppConfig.class]: Invocation of init method failed; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:569)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:200)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)
… 8 more

Thanks
Gaga


#4

Hi,

By Camunda DB you mean the H2 database?
Not sure if I can help with this MySQL error…


#5

Hi,

In the above case the Camunda DB is MySQL DB and the other DB is Oracle DB

I have also tried by keeping H2 DB as Camunda Db and the other DB as My SQL DB. It works fine by updating the data in Camunda default tables in H2 DB and any table within MySQL Db but i when i try to explicitly connect to H2 DB by registering a bean in Spring context so as to update the data in custom table in H2 DB it fails with the same error. The conclusion is Camunda doesnt allow me to open connection with two or more databases at the same time so as to update the custom tables within the Databases. Thanks