I need to export\transfer options (such as DataSource to MySQL) to other PC\server. How to do it correctly?
I had tried to copy and rename standalone.xml and run it on other PC by following command:
./standalone.sh --server-config=standalone-(full)-myProject.xml
Is it right way?
And next problem - how export installed module (in WildFly) for MySQL correctly?
I installed it like this (as module) at my machine http://hpehl.info/jdbc-driver-setup.html
I would strongly encourage you to use the jboss-cli to run this instead. Copying the files will work but I would argue that it's better to have a repeatable process.
To add a datasource, you'd run the following. Since you're using WildFly 9, it can be a bit simpler. Put the following commands in a file - for example, db_setup.txt. Then run $WILDFLY_HOME/bin/jboss-cli.sh --file=db_setup.txt
. The file will contain something like the following:
embed-server --std-out=echo --server-config=standalone.xml
batch
module add --name=com.mysql.driver --resources=/path/to/mysql-connector-java-5.1.33.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=mysql:add(driver-name="mysql",driver-module-name="com.mysql.driver",driver-class-name=com.mysql.jdbc.Driver)
/subsystem=datasources/data-source=myPool/:add(connection-url=jdbc:mysql://127.0.0.1:3306/dbName,driver-name=mysql,jndi-name=java:/jdbc/dbName,password=password,user-name=user)
WARNING - I have not fully tested these commands so they may require a bit of tweaking. But the concepts are there.
The one issue you'll have is that, during testing, the jboss-cli.sh command will just exit if there is an error. You may want a file to remove these too:
/subsystem=datasources/data-source=myPool/:remove
/subsystem=datasources/jdbc-driver=my:remove
module remove --name=com.mysql.driver