I am using
- camunda-bpm-wildfly-7.4.0
- mysql-5.6.24-winx64
- wildfly-8.2.1.Final
I have integerated mysql with camunda wildfly.
My datasource code in the standalone.xml is as follows,
<datasource jta="true" jndi-name="java:jboss/datasources/ProcessEngine" pool-name="ProcessEngine" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:8888/camundabpm?DB_CLOSE_DELAY=-1;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>mysql</driver>
How do I prevent the database resetting on server restart? It removes all data and replaces it with new data on every server start. So I am unable to persist my data between server on and off.
Update:
I found out that hibernate was deleting the tables from the db So I changed the property from this
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
to
<property name="hibernate.hbm2ddl.auto" value="update" />
after having a look at How to make Hibernate not drop tables. But now the tasklist process instances are removed and only the tables created by my project remain and all other tables are refreshed with new data.
Can you check the value of the databaseSchemaUpdate poroperty? It should be contained in the standalone.xml of our WildFly (very down). Make sure it os not set to create-drop.
See https://docs.camunda.org/manual/7.4/reference/deployment-descriptors/tags/process-engine/#configuration-properties
Related
Project Technologies: Java spring hibernate + MySQL
I have created a replica schema say "abc_uat" from my production schema "abc" on the same server.
I changes connection string in Java code to point to new replica schema (abc_uat), as follows -
<property name="url" value="jdbc:mysql://abc.com:3306/ABC_UAT?autoReconnect=true" />
<property name="username" value="user" />
<property name="password" value="pass" />
Earlier the connection details used to be like this -
<property name="url" value="jdbc:mysql://abc.com:3306/ABC?autoReconnect=true" />
<property name="username" value="user" />
<property name="password" value="pass" />
Surprisingly, when I run this program, MySQL still connects with "abc" schema and not "abc_uat".
During debug, I can see Java code is properly creates connection to new schema (abc_uat), however, the data that is received back is from production schema( abc).
Here is how I had created replica -
I used export data into sql dump file on "abc" and then import data function to create tables and data into "abc_uat".
Can someone please point me, what am I missing?
I have put hive-site.xml in my spark/conf dir and configured it to connect to thrift://<user>:9083 and I am not using derby I have mysql-connector-jar inside hive/lib folder , still every time I create hive table and store data , all data are stored in metastore_db in my project directory instead in my hdfs://<user>:9000/user/hive/warehouse, so if I delete metastore_db data is lost.
conf/hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://saurab:3306/metastore_db?
createDatabaseIfNotExist=true</value>
<description>metadata is stored in a MySQL server</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>MySQL JDBC driver class</description>
</property>
<property>
<name>hive.aux.jars.path</name>
<value>/home/saurab/hadoopec/hive/lib/hive-serde-
2.1.1.jar</value>
</property>
<property>
<name>spark.sql.warehouse.dir</name>
<value>hdfs://saurab:9000/user/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://saurab:9083</value>
<description>URI for client to contact metastore
server</description>
</property>
This is my thriftserver log.Mysql server is running.So why it is still creating metastore_db and storing data there.
I would say you have made those changes on the Spark conf folder but not on the server one (at least not all of them).
Notice on the server log:
"metastore.MetaStoreDirectSql: Using direct SQL, underlying DB is DERBY"
A common practice is instead of copying the config under spark/conf just add a link from there to /etc/hive/conf/hive-site.xml, to make sure client and server are using the same configuration.
My advice is to setup the server side correctly first (you also have a port conflict), test it with beeline and only them start using it from Spark
I'm Pretty new to wildfly 10. i have my datasources working and my connector working. i have successfuly connections. i have the prefill setting selected. it just doesn't populate my sql database with any tables.
<datasource jta="true" jndi-name="java:/MySqlDS" pool-name="MySqlDS" enabled="tru$
<connection-url>jdbc:mysql://<IP>:3306/DatabaseName?useSSL=false</connection-$
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<pool>
<min-pool-size>50</min-pool-size>
<max-pool-size>500</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensi$
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysq$
</validation>
</datasource>
You're missing the purpose of prefill. It is to fill the database connection pool pretty much on startup. It doesn't create any tables for you. Usually that is an external process like a SQL script to create the tables. There are other options such as Hibernate that can create tables on startup but that is a different question.
Bydefault JBoss will not create any table in Mysql DB schema, you have to deploy application which will create table in DB schema. Why you are expecting JBoss to create tables in DB schema ?
I have tried all steps described in http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/oracle-and-mysql-persistence-layers#TOC-MySQL2 . I am using Orbeon Forms 4.7 and XAMPP v3.2.1.
My steps are:
Create a new user orbeon with password orbeon and new schema orbeon.
Create the tables used for Orbeon Forms in the orbeon schema.
Download mysql-connector-java-5.1.33-bin.jar and copy it in xampp\tomcat\lib.
Edit Tomcat's server.xml, and within the for Orbeon Forms adding a
<Resource> element, i.e.:
<Resource name="jdbc/mysql" auth="Container" type="javax.sql.DataSource"
initialSize="3" maxActive="10" maxIdle="20" maxWait="30000"
driverClassName="com.mysql.jdbc.Driver"
poolPreparedStatements="true"
validationQuery="select 1 from dual"
testOnBorrow="true"
username="orbeon"
password="orbeon"
url="jdbc:mysql://localhost:3306/orbeon?useUnicode=true&characterEncoding=UTF8"/>
Now after I create the form,there is no data in mysql.
Is there any solutions or any steps I done wrong?
Based on your list of steps, it looks like you have missed the "Orbeon Forms setup" section of the docs. By default, all forms for all apps (except samples which are resource based) are configured to use the built-in eXist database.
You can use:
<property as="xs:string"
name="oxf.fr.persistence.provider.*.*.*"
value="mysql"/>
I noticed that with that configuration, the global library with the US Address section template disappears, so if you want that to show up, you need to also use:
<property as="xs:string"
name="oxf.fr.persistence.provider.orbeon.library.*"
value="exist"/>
Alternatively, you can just configure specific apps to use mysql:
<property as="xs:string"
name="oxf.fr.persistence.provider.hr.*.*"
value="mysql"/>
<property as="xs:string"
name="oxf.fr.persistence.provider.finance.*.*"
value="mysql"/>
Those aren't the only properties though. See the doc for the rest:
http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/oracle-and-mysql-persistence-layers#TOC-Orbeon-Forms-setup
I am preparing some application with usage of JPA 2.0, Hibernate as provider, MySQL 5 as database, which will be deployed on JBoss AS 7.0.2.I have already configured some basics in persistence.xml and I came into some kind of trouble. I have noticed that some people also defines some specific DataSource on JBoss Management Console level.
My question is. Do I really need to worry about some DataSource or anything like that in Hibernate application?I thought it is important in old JDBC approach.In some books, where examples are shown, there is no such configuration in persistence.xml or hibernate.cfg.xml
Do I have to place mysql connector into JBOSS_HOME/standalone/deployments directory to use MySQL in my application?Here is content of my persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="SomeApp">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/somedb" />
<property name="hibernate.connection.username" value="" />
<property name="hibernate.connection.password" value="" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
</properties>
</persistence-unit>
</persistence>
Well, you can either access the database by:
providing the url/driver/password/etc. information in the persistence.xml using your jpa-provider properties (in your case hibernate.connection.*) or the JPA 2.0 standardised javax.persistence.jdbc.* ones - this basically looks like the example you've posted,
creating a Data Source in the ApplicationServer and just referring to it in the persistence.xml (through it's JNDI name you provide during creation) which might look similar to this (without the XML schema definition for the sake of brevity) :
<persistence>
<persistence-unit name="SomeApp">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/myDB</jta-data-source>
</persistence-unit>
</persistence>
What you're actually doing right now (with these properties) is using the JDBC.
I would definitely go with the creation of the Data Source in the ApplicationServer rather than providing it in the properties in persistence.xml. It allows you to dynamically change the end-database, it's type, credentials, manage connection pools, etc. without even touching your descriptor.
It's also safer, as the credentials are not written in the plain file left on your server.
As a side note, please remember that the javax.persistence.jdbc.* properties are a JPA provider must requirement for the Java SE environment, but it's optional for Java EE.
Hope that helps!
Do I have to place mysql connector into
JBOSS_HOME/standalone/deployments directory to use MySQL in my
application?
Yes you need to put Mysql J/connector for use it as JDBC Driver. Your application server (JBOss, Weblogic, Glassfish, etc) doesn't provide it because depend of the RDBMS that you are using (in this case Mysql) and the version of it.
In the case of JBoss 7 the JDBC driver can be installed into the container in one of two ways: either as a deployment or as a core module. For the pros/cons of both modes an detailed explanatio you can check the following documentation: http://community.jboss.org/wiki/DataSourceConfigurationInAS7