This is possible, you can use the dbaccess or a 3rd party application (SQLCMD for example).
With dbaccess , if you want to use the user password , must create the SQL into a file and execute this file with dbaccess,
if you try execute in another way will get error -32412:
Code:
/tmp> echo " connect to \"db@myserver\" user dummy using ymmud" | dbaccess
32412: USING clause unsupported. DB-Access will prompt you for a password.
Error in line 1
/tmp> finderr 32412
-32412 USING clause unsupported. DB-Access will prompt you for a password.
DB-Access does not support the USING password clause in a CONNECT ...
USER statement when it violates security. For example, do not type a
password on the screen where it can be seen or include it in a command
file that someone other than the user can read. To maintain security,
DB-Access prompts you to enter the password on the screen and uses echo
suppression to hide it from view.
Code:
INFORMIXSERVER=$1
USR=$2
PWD=$3
ENV=$4
DB=$5
IFMX="/opt/informix/bin/dbaccess"
echo "
connect to \"$DB@$DB_INSTANCE\" user $USR using $PWD ;
execute procedure SP_PRECAL_ALERT_EXPIRY('12') ;
" > /tmp/sql.tmp.$$
dbaccess - /tmp/sql.tmp.$$ >/dev/null 2>&1
## to debug the SQL
## dbaccess -e - /tmp/sql.tmp.$$
rm -f /tmp/sql.tmp.$$ >/dev/null 2>&1