1。运行db2cmd命令;2。在弹出的窗口中运行db2 connect to DBname user userID using password;3。userID是登陆用户名,password是登陆密码;