get_JDBCProvider.sh

 


###
### get_JDBCProvider.sh
###
###
### Calls get_JDBCProvider.jacl
###
### Take the output and plug it into set_DS.jacl
###
###        
###
###
### Usage:
###    get_JDBCProvider.sh -c cell -n node -s server
###
###

USAGE="
Usage: $0 -u username -p password -c cell -n node -s server
"


while getopts "u:p::c:n:s:l" opt; do
  case $opt in
    u ) xuser=$OPTARG ;;
    p ) xpasswd=$OPTARG ;;
    c ) xcell=$OPTARG ;;
    n ) xnode=$OPTARG ;;
    s ) xserver=$OPTARG ;;
    * ) echo $USAGE
         exit 1 ;;
  esac
done


if [ "$xserver" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xuser" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xpasswd" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xcell" = "" ]
then
    echo $USAGE
    exit 1
fi

if [ "$xnode" = "" ]
then
    echo $USAGE
    exit 1
fi





echo "### "
echo "### set_JDBCProvider.jacl "
echo "### "
echo "### "
echo "### When refreshing this script "
echo "### "
echo "### "
echo "### "
echo "### We set up JDBC Providers with one word names "
echo "### in order to avoid problems using getid later. "
echo "### "
echo "### I have been unable to run "
echo "### "
echo "###   \$AdminConfig getid /Cell:\$cname/Node:\$nname/Server:\$sname/JDBCProvider:Oracle JDBC Driver/ "
echo "### "
echo "### Get an error each time, even if I add quotes around name.  However... "
echo "### "
echo "###   \$AdminConfig getid /Cell:\$cname/Node:\$nname/Server:\$sname/JDBCProvider:Oracle_JDBC_Driver/ "
echo "### "
echo "### ...works fine. "
echo "### "
echo "### "
echo " "
echo "proc set_JDBCProvider {cname nname sname} { "
echo " "
echo " "
echo "### "
echo "### set up globals "
echo "### "
echo " "
echo "global AdminConfig "
echo "global AdminControl "
echo "global AdminApp "
echo " "
echo "puts \"Setting JDBCProvider for \$cname \$nname \$sname\" "
echo " "
echo "puts \"Settings serverid...\" "
echo "set serverid [\$AdminConfig getid /Cell:\$cname/Node:\$nname/Server:\$sname/] "
echo " "
echo "if {[llength \$serverid] == 0} { "
echo "    puts \"Serverid null - returning \" "
echo "    exit "
echo "} "
echo " "
echo " "
echo " "
echo "### "
echo "### Configure JDBCProviders "
echo "### "
echo " "
echo "puts \"Configuring providers...\" "
echo " "
echo " "
echo "################################################################## "
echo "### The code below is derived from get_JDBCProvider.jacl "
echo "### "
echo "### If you use a variable for classpath, make sure variable "
echo "### is defined under Environment | Manage WebSphere Variables "
echo "### "








###
### For the sed commands below
### If line begins with xyz, append to line above
###
echo "wsadmin.sh -username $xuser -password $xpasswd -f get_JDBCProvider.jacl $xcell $xnode $xserver" 

wsadmin.sh -username $xuser -password $xpasswd -f get_JDBCProvider.jacl $xcell $xnode $xserver | \
grep -v WASX7209I:  | \
sed "s/}$/} \\\\/g" | \
sed "s/} $/}} /g" 






echo "   "
echo "   "
echo "###   "
echo "##################################################################   "
echo "      "
echo "\$AdminConfig save      "
echo "   "
echo "   "
echo "### Synchronize nodes   "
echo "   "
echo "puts \"Synchronizing nodes...\"   "
echo "set Sync1 [\$AdminControl completeObjectName type=NodeSync,node=\$nname,*]   "
echo "set xstatus [\$AdminControl invoke \$Sync1 sync]   "
echo "   "
echo "if {\$xstatus == \"false\"} {   "
echo "    puts \"Unable to synchronize nodes...\"   "
echo "}   "
echo "   "
echo "      "
echo "}      "
echo "      "
echo "      "
echo "      "
echo "###      "
echo "### Main      "
echo "###      "
echo "      "
echo "      "
echo "if { !(\$argc == 3) } {      "
echo "   puts \"\"      "
echo "   puts \"Usage:  \"      "
echo "   puts \" \"      "
echo "   puts \"wsadmin.sh -username system -password password -f set_JDBCProvider.jacl cellname nodename servername\"    "
echo "   puts \"\"      "
echo "   puts \"For example:  \"      "
echo "   puts \" \"      "
echo "   puts \"wsadmin.sh -username was -password acme@ -f  set_JDBCProvider.jacl hostnameNetwork hostname ops_1_1\"    "
echo "} else {       "
echo "   set xcell        [lindex \$argv 0]        "
echo "   set xnode        [lindex \$argv 1]        "
echo "   set xserver      [lindex \$argv 2]        "
echo "   set_JDBCProvider \$xcell \$xnode \$xserver       "
echo "}      "


 

 

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.