To access DB2 via the command line on a UNIX/Linux box you need…
- The DB2 client installed on the box
- The DB you’re trying to connect to cataloged in the client
Once you know you have that, simply source your db2profile and connect…
. /path/to/db2profile
db2 connect to DBCATNAME user yourid using yourpw
… where DBCATNAME is the name the DB is cataloged as on that box, yourid is your user ID for connecting to the DB, and yourpw is your password for connecting to the DB. Note, that if the actual database resides on the same box, and you want to login as the user your logged into the UNIX box as, you can simplify the connect string and not have to include your user ID or password…
. /path/to/db2profile
db2 connect to DBNAME
Please remember to subscribe to the newsletter to stay up to date!You or someone you know looking to buy or sell?
Disclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...