#!/usr/bin/bash
# usage: epmsql.sh USER poc hana_addr
#epmsql.sh beginner100 others www.epmsquare.cn:30515

if [ $# -eq 0 ]; then
   echo 'epmsql.sh USER poc hana_addr'
   exit 1
fi

SYSPASSWORD='Wang_2017'

user=$1
HANA_ADDR=$3
case $2 in
test1)
    HANA_ADDR='hanatest1.epmtest.cn:30115'
    ;;
test2)
    HANA_ADDR='hanatest2.epmtest.cn:30115'
    ;;
test3)
    HANA_ADDR='hanatest3.epmtest.cn:30115'
    ;;
prod2)
    HANA_ADDR='hana2.epmprod.cn:30115'
    ;;
poc1)
    HANA_ADDR='hanapoc1.epmtest.cn:30115'
    ;;
poc2)
    HANA_ADDR='hanapoc2.epmtest.cn:30115'
    ;;
poc3)
    HANA_ADDR='hanapoc3.epmtest.cn:30115'
    ;;
poc4)
    HANA_ADDR='hanapoc4.epmtest.cn:30115'
    ;;
poc5)
    HANA_ADDR='hanapoc5.epmtest.cn:30115'
    ;;
of1)
    HANA_ADDR='192.168.124.229:30115'
    ;;
of2_test1)
    HANA_ADDR='192.168.124.204:30115'
    ;;
of2_test2)
    HANA_ADDR='192.168.124.130:30115'
    ;;
others)
    echo 'use self defined hana address'
    ;;
*)
    echo unknown option >&2
    exit 1
esac



if [[ $user == 'SYSTEM' ]]; then
    echo "hdbsql -u system -p $SYSPASSWORD -n $HANA_ADDR"
    hdbsql -u system -p $SYSPASSWORD -n $HANA_ADDR
else
   echo "hdbsql -u $1 -p EPM_user_2017 -n $HANA_ADDR"
   hdbsql -u $1 -p EPM_user_2017 -n $HANA_ADDR
fi