I am a noob in running db2 commands in the unix environment, so I have been trying to connect to a db2 instance from a bash script. However I get errors here is what my script looks like:
#!/bin/bash
DB2="java com.ibm.db2.clp.db2"
$DB2 "connect to <db2 server here> user **** using ****"
I get a DSNC102I : The option "connect to <db2 server> user **** using ****" specified after the "db2" command is incorrect.
I do not know what to do from here.
Currenty I am able to run an sql script from the same bash script by using
$DB2 -tvf part3.sql
where both connection details and sql queries are in the part3.sql file.
Why can't I achieve the same results by writing the sql commands themselves in the bash script.
PS: I want this since I my bash script is required to accept any db2 instance/ schema to conduct queries as a parameter to the bash script
db2 "connect ..."
,db2 -tvf part3.sql
?clp.jar
file on Linux, Unix and Windows platforms), then remove thedb2-luw
tag.