Reputation: 4512
I have a simple Java app that suddenly stopped connecting to a local DB2 database, citing an incorrect password as the cause. The database authenticates with the Windows user credentials. I was using a password that contained a semicolon and some parentheses, and when I changed this to something simpler, the app was able to connect again.
My question is: is there any way in which these characters in the password could have been causing a login failure?
The exception was: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] SQL30082N Security processing failed with reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001
And the connection code looks like:
String username = "username";
String password = "pass;w(ord)";
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
db2Connection = DriverManager.getConnection("jdbc:db2:DBNAME", username, password);
Upvotes: 0
Views: 3158
Reputation: 7693
Try to connect to the database via the Command Window in order to be sure that everything is Okay:
c:\>db2 connect to dbname user username using pass;w(ord)
or in the db2 command line
db2> connect to dbname user username using pass;w(ord)
Probably the connection method, the credentials, or the firewall rules have changed,
Once you could reach the database by giving the correct credentials, you can now check the problem in Java.
One step before trying in Java is to connect from DataStudio. This is a Java application, so you could verify that it is possible to connect to your database from Java.
Upvotes: 0
Reputation: 3321
Where a DB2 password contains special characters it needs to be quoted in the connection string.
Try changing your password
variable to:
String password = "\"pass;w(word)\"";
Upvotes: 1