Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install oracle driver on Wildfly
#!/bin/bash
#title :wildfly-install-oracle.sh
#description :The script to install oracle drive in Wildfly 10.x
#usage :/bin/bash wildfly-install-oracle.sh
DRIVER_VERSION=11.2.0
DRIVER_FILENAME=ojdbc6-${DRIVER_VERSION}
DRIVER_UNTAR_NAME=${DRIVER_FILENAME}.jar
DRIVER_DOWNLOAD_ADDRESS=hhttps://www.dropbox.com/s/6smy2smg71jhgnx/ojdbc6-11.2.0.jar
MODULE_NAME=oracle
INSTALL_DIR=/opt
WILDFLY_FULL_DIR=$INSTALL_DIR/$WILDFLY_FILENAME
WILDFLY_DIR=$INSTALL_DIR/wildfly
WILDFLY_USER="wildfly"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root."
exit 1
fi
mkdir -p ${WILDFLY_DIR}/modules/com/${MODULE_NAME}/driver/main/
wget ${DRIVER_DOWNLOAD_ADDRESS} -O ${WILDFLY_DIR}/modules/com/${MODULE_NAME}/driver/main/${DRIVER_UNTAR_NAME}
cat << EOF > ${WILDFLY_DIR}/modules/com/${MODULE_NAME}/driver/main/module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.${MODULE_NAME}.driver">
<resources>
<resource-root path="${DRIVER_UNTAR_NAME}" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.mail.api" />
<module name="javax.servlet.api" />
<module name="javax.servlet.jsp.api" />
<module name="javax.transaction.api" />
</dependencies>
</module>
EOF
chown -R ${WILDFLY_USER}:${WILDFLY_USER} ${WILDFLY_DIR}/modules/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.