Windows – How to connect to DB2 when the password ends with ‘!’ in Windows

db2windows

I am facing a problem to use the DB2 tools when using generic account with a generated password which ends with the Bang sign '!' to connect to DB2 database. I am not allowed to change the password because it is already used by other processes.

I know the user is valid and I can connect to the database with its credentials, but not from all db2 tools.

When using the Control Center it is okay.
When using the Command Editor (GUI) or the Command Windows, I got this error message:

connect to WAREHOUS user administrator using       !
SQL0104N  An unexpected token "!" was found following "<identifier>".  
Expected tokens may include:  "NEW".  SQLSTATE=42601

Let's say that my password is: pass@!
I am trying to use

c:\>db2 connect to sample user administrator using "pass@!"

or

c:\>db2 connect to sample user administrator using pass@!

And it both cases I got the same error message.

I could change the way I connect but it is not useful for me, for example:

c:\>db2 connect to sample user administrator
Enter current password for administrator:

But I cannot use it from a batch file easily.

I would like to know how can I connect from the Command Editor, in order to use this user from the Graphical Tools.

BTW, I know that the Control Center is deprecated.

Best Answer

For the command line, you can try single quotes

c:\>db2 connect to sample user administrator using 'pass@!'

No solution for the GUI tools