#!/usr/bin/bash
# usage: epmsql.sh DBname poc

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

SYS_PASSWORD='Wang_2023'
SYS_USER='postgres'

dbname=$1
ADDR=$3
PORT=5432
case $2 in
poc1)
    ADDR='pgtest1.epmtest.cn'    
    ;;
dev1)
    ADDR='192.168.124.189'
    ;;
dev2)
    ADDR='192.168.124.229'
    PORT=5433
    ;;
others)
    echo 'use self defined hana address'
    ;;
*)
    echo unknown option >&2
    exit 1
esac

# -h hanatest1.epmtest.cn -p 5432 -U postgres -d yatal
echo "psql -h $ADDR -p $PORT -U $SYS_USER -d $dbname"
psql -h $ADDR -p $PORT -U $SYS_USER -d $dbname