Configure mysql datasource in wildfly 8.0

Add mysql module to wildfly application server:

1. Go to wildfly-8.0.0.Final\modules\system\layers\base\com
2. Create folder like “sql\mysql\main\” and go to sql\mysql\main\
3. Place mysql connector jar to main folder
4. Place module.xml file to main folder

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.sql.mysql">
     <resource-root path="mysql-connector-java-5.0.4-bin.jar"/>              
     <module name="javax.api"/>

Add datasource to wildfly configuration file

1. Go to C:\Program Files\wildfly-8.0.0.Final\wildfly-8.0.0.Final\standalone\configuration
2. Open standalone.xml file (we assume you are using standalone.xml as server configuration file)
3. Add following code to datasources section

	<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
	<datasource jndi-name="java:jboss/datasources/brachub" pool-name="brachub" enabled="true" use-java-context="true">
		<driver name="mysql" module="com.sql.mysql">
		<driver name="h2" module="com.h2database.h2">

Hope this will work.


OpenJDK + Glasshfish + centOS

To show OpenJDK current version

To install openJDK please follow:

$ update-alternatives --display java
 slave pack200.1.gz: (null)
 slave rmid.1.gz: (null)
 slave rmiregistry.1.gz: (null)
 slave servertool.1.gz: (null)
 slave tnameserv.1.gz: (null)
 slave unpack200.1.gz: (null)
 Current `best' version is /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java.

Java environment setup

Set JAVA_HOME / PATH for a single user
Login to your account and open .bash_profile file

$ vi ~/.bash_profile

Set JAVA_HOME as follows using syntax export JAVA_HOME=. set it as follows:

export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

Set PATH as follows:

export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin

Type the following command to activate the new path settings immediately:

$ source ~/.bash_profile


$ . ~/.bash_profile

Verify new settings:

$ echo $JAVA_HOME
$ echo $PATH
$ which java

Set JAVA_HOME / PATH for all user

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:

vi /etc/profile

Next setup PATH / JAVA_PATH variables as follows:

export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin
export PATH=$PATH:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin

Save and close the file. Once again you need to type the following command to activate the path settings immediately:

source /etc/profile
. /etc/profile 

Important link: