• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 992
  • Last Modified:

Database Connection Problem

1) We have DB2 8.0.1 on Red Hat Linux 9
2) I am able to create user in linux using USERADD and then set password using PASSWD
3) Then I have granted connect on database & other privileges to this user
4) On connecting it says invalid USERID/PASSWORD
5) Normally in control center, we first add user and then give connect etc. authorizations and privileges
6) GUI got disabled/corrupted on our linux.
7) How can I add a user to database without control center so that I can connect to it.
0
k_murli_krishna
Asked:
k_murli_krishna
  • 5
  • 5
1 Solution
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi k,

Log into the unix system as root.  If you're on a GUI, open a terminal window.

Then create a user:

  adduser -p password user


You should be able to connect to the database with this user.


Good Luck,
Kent
0
 
k_murli_krishnaAuthor Commented:
I created both with useradd and adduser (your way). But not connecting. I used passwd to reset the password but still not connecting. Error is:
SQL30082N  Security processing failed with reason "24" ("USERNAME AND/OR
PASSWORD INVALID").  SQLSTATE=08001
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Odd.

Check the authentication type.  On your UDB server, enter the following:

db2 connect to <databasename>
db2 get dbm cfg | grep AUTHEN

You should get one line back that looks something like this:

 Database manager authentication        (AUTHENTICATION) = SERVER


The parameter should be set to 'SERVER' like you see here.


Kent
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
k_murli_krishnaAuthor Commented:
Already Authentication is SERVER, I checked. I think it has something to do with user not added to database like we do in control center OR it is password status problem. When I created user using userdd followed by passwd or adduser, it gets into same named group.

Then I give connect and other privileges on database. But on logging in into linux with these credentials, db2 is not recognized which is begin of any command. Even when I go to bin it is not recognized. How to make it recognized?
0
 
Kent OlsenData Warehouse Architect / DBACommented:

The user needs to execute the db2 profile.  Add a line to the user's profile:

. /home/<instance owner>/sqllib/db2profile

(note that he line starts with dot space slash)



Kent
0
 
k_murli_krishnaAuthor Commented:
Kent, I am increasing the points.
While connecting with user to database on linux after giving connect permission from admin user connect:
From client command window and control center
SQL30082N  Security processing failed with reason "24" ("USERNAME AND/OR
PASSWORD INVALID").  SQLSTATE=08001

There is no new fixpack & not sure about recently changed permissions on DB2 critical files such as db2ckpw.
Any problem if I run db2iupdt just like that. Looks risky.

From SSH terminal client. Server control center is not opening since GUI is disabled. telnet to server is also failing. Are these linked with this connection problem.
get dbm cfg
AUTHENTICATION = SERVER

. /home/db2inst1/sqllib/db2profile, then

DB2INSATNCE = db2inst1 & db2 is recognized

On trying to connect:
SQL0902C  A system error (reason code = "") occurred.  Subsequent SQL
statements cannot be processed.  SQLSTATE=58005

Set this in users .bash_profile, then

DB2INSATNCE = /home/db2inst1/db2inst1 & db2 is not recognized (just yesterday this was working fine)

ENV & SET commands: What does their output show and what is the difference between the two?

First created user as it is, then its group got added as a db2 group to database on giving connect privilege. Trying to add user from client control center, then not listing users in drop down after warning that das may not have been started. I checked & it is active. So, I manually typed user name, checked connect checkbox but not connecting now also.

Now created user assigning it to group db2grp1 & it is added properly in client control center with connect check box already checked but even now not connecting.

Setting password of user using passwd.
0
 
Kent OlsenData Warehouse Architect / DBACommented:

Ok.  Let's drop back and start with the basics.

From the command line interface, try to connect to a database.

>db2 connect to <database> user <USERNAME> using "<PASSWORD>"


Kent
0
 
k_murli_krishnaAuthor Commented:
Message is SQL30082N  Security processing failed with reason "24" ("USERNAME AND/OR
PASSWORD INVALID").  SQLSTATE=08001
The thing is SSH terminal client is not asking for change of password on logging in first time after user has been created. I have not tried from within linux server. Thats a ray of hope. telnet is jumping out.
ENV & SET commands: What is the difference between the two? is it OS & DB2 variables respectively. Is there no registry in linux like in windows?
0
 
Kent OlsenData Warehouse Architect / DBACommented:


That's an excellent point.  A user may often have to change their password after it is set by an administrator.  Try logging into the server using telnet or SSH.  Hopefully, it will force you to change your password.

linux doesn't use a registry like Windows does.  
0
 
k_murli_krishnaAuthor Commented:
If I keep . {INSTHOME}/sqllib/db2profile in users .bash_profile it is not working. Maybe ${INSTHOME?}/sqllib/db2profile will work. Am I configuring in the correct profile file?

But when I use . {INSTHOME}/sqllib/db2profile at shell prompt itself temporarily, db2 is recognized.

Also, with instance user db2inst1 the instance is showing correctly using ENV or SET commands i.e. DB2INSTANCE = db2inst1. Any other user including root it is showing as /home/db2inst1/db2inst1. Is this correct & if not how do set it right? What is difference between ENV and SET?

From linux server also, on creating user with password or setting it with passwd using root, on logging out and logging in for first time it is not asking to reset password i.e. it is logging in successfully. If we just create user using useradd or adduser command without mentioning password what password gets set? In this case if I know it I maybe prompted to change password on first login and the whole thing may work. Please help. Thank you.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now