Use mysql database table

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2014 06:39 AM
Hi,
I want to create a process that inserts data into a mysql table that I've created. I wonder if this is possible?
I know that activiti uses a h2 database by default, but I want to use a mysql database instead.
I've created a maven project in eclipse and added the following dependency to my pom.xml:
dependency
groupId mysql groupId
artifactId mysql-connector-java artifactId
version 5.1.13 version
dependency
I've also added databasetype, jdbcUrl, jdbcDriver, jdbcUsername and jdbcPassword to my activiti.cfg.xml file. Is there anything else I need to do?
I just want data to be added at a certain step in my process, would this be possible to do?
I've also created a JUint test and when I run this I get errors:
org.activiti.engine.ActivitiException: couldn't check if tables are already present using metadata:
### Error getting a new connection. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at org.activiti.engine.impl.db.DbSqlSession.isTablePresent(DbSqlSession.java:879)
at org.activiti.engine.impl.db.DbSqlSession.isEngineTablePresent(DbSqlSession.java:834)
at org.activiti.engine.impl.db.DbSqlSession.dbSchemaUpdate(DbSqlSession.java:767)
at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1145)
…
Any suggestions?
Thank you!
I want to create a process that inserts data into a mysql table that I've created. I wonder if this is possible?
I know that activiti uses a h2 database by default, but I want to use a mysql database instead.
I've created a maven project in eclipse and added the following dependency to my pom.xml:
dependency
groupId mysql groupId
artifactId mysql-connector-java artifactId
version 5.1.13 version
dependency
I've also added databasetype, jdbcUrl, jdbcDriver, jdbcUsername and jdbcPassword to my activiti.cfg.xml file. Is there anything else I need to do?
I just want data to be added at a certain step in my process, would this be possible to do?
I've also created a JUint test and when I run this I get errors:
org.activiti.engine.ActivitiException: couldn't check if tables are already present using metadata:
### Error getting a new connection. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at org.activiti.engine.impl.db.DbSqlSession.isTablePresent(DbSqlSession.java:879)
at org.activiti.engine.impl.db.DbSqlSession.isEngineTablePresent(DbSqlSession.java:834)
at org.activiti.engine.impl.db.DbSqlSession.dbSchemaUpdate(DbSqlSession.java:767)
at org.activiti.engine.impl.db.DbSqlSession.performSchemaOperationsProcessEngineBuild(DbSqlSession.java:1145)
…
Any suggestions?
Thank you!
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2014 04:40 AM
Hi,
Did you configure mysql connection properly?
can you connect to mysql server?
Regards
Martin
Did you configure mysql connection properly?
can you connect to mysql server?
Regards
Martin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2014 07:28 AM
Hi,
I've followed the following tutorial "http://www.attuneuniversity.com/blog/change-database-from-h2-to-mysql-in-activiti.html"
that explains how to change from a h2 database to a mysql database in Activiti.
I've changed both db.properties "C:\apache-tomcat-7.0.54\webapps\activiti-rest\WEB-INF\classes" and
"C:\apache-tomcat-7.0.54\webapps\activiti-explorer\WEB-INF\classes"
into:
db=activiti
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username=root
jdbc.password=root
I've also added the mysql-connector jar into the lib folders and added the properties for this driver in my activiti.cfg.xml file.
I can start my sql server from commando prompt if that is what you meant?
I cannot connect to the server through the browser (localhost:3306).
Do I need to write some java code in order for these changes to be applied, or what am I missing?
When I run my code I get an error saying:
"Exception while initializing Database connection"
"java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: org.h2.Driver"
But I'm not using a h2 database, so it seems like my changes isn't applied since it tries to use the default database. I don't know what I'm missing.
Regards,
I've followed the following tutorial "http://www.attuneuniversity.com/blog/change-database-from-h2-to-mysql-in-activiti.html"
that explains how to change from a h2 database to a mysql database in Activiti.
I've changed both db.properties "C:\apache-tomcat-7.0.54\webapps\activiti-rest\WEB-INF\classes" and
"C:\apache-tomcat-7.0.54\webapps\activiti-explorer\WEB-INF\classes"
into:
db=activiti
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username=root
jdbc.password=root
I've also added the mysql-connector jar into the lib folders and added the properties for this driver in my activiti.cfg.xml file.
I can start my sql server from commando prompt if that is what you meant?
I cannot connect to the server through the browser (localhost:3306).
Do I need to write some java code in order for these changes to be applied, or what am I missing?
When I run my code I get an error saying:
"Exception while initializing Database connection"
"java.sql.SQLException: Error setting driver on UnpooledDataSource. Cause: java.lang.ClassNotFoundException: org.h2.Driver"
But I'm not using a h2 database, so it seems like my changes isn't applied since it tries to use the default database. I don't know what I'm missing.
Regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2014 08:40 AM
Hi, again
I've added the following code:
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseType("mysql")
.setJdbcUrl("jdbc:mysql://192.168.1.73:3306/activiti")
.setJdbcDriver("com.mysql.jdbc.Driver")
.setJdbcUsername("activiti")
.setJdbcPassword("activiti")
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)….
And now it no longer tries to connect to the default database (h2), instead tries to connect to jdbc:mysql://192.168.1.73:3306/activiti which I want. But when I run my code I get the following error:
org.activiti.engine.ActivitiException: couldn't check if tables are already present using metadata:
### Error getting a new connection. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
…
What am I missing?
Thanks,
I've added the following code:
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseType("mysql")
.setJdbcUrl("jdbc:mysql://192.168.1.73:3306/activiti")
.setJdbcDriver("com.mysql.jdbc.Driver")
.setJdbcUsername("activiti")
.setJdbcPassword("activiti")
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)….
And now it no longer tries to connect to the default database (h2), instead tries to connect to jdbc:mysql://192.168.1.73:3306/activiti which I want. But when I run my code I get the following error:
org.activiti.engine.ActivitiException: couldn't check if tables are already present using metadata:
### Error getting a new connection. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
…
What am I missing?
Thanks,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2014 09:13 AM
Hi!
It works now, I had to download mysql installer aswell, stupid misstake
Thank you for your help!
It works now, I had to download mysql installer aswell, stupid misstake

Thank you for your help!
