Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In IBM Data Studio, I can create a connection to a remote IBM DB2 LUW database named DBEMP and browse the schema and data.

Here is the steps to create the database connection:

  1. From IBM Data Studio, In Database Adminstration Explorer, select: New -> New Connection to Database.
  2. Select DB2 for Linux, UNIX, and Windows in the dialog.
  3. In General properties:

    Database: DBEMP
    Host: 10.221.5.111
    Port Number: 50001
    User Name: user1
    Password: *

  4. Click OK.


But when I tried to connect to the remote database server (AIX v7) via telnet command:

telnet 10.221.5.111

Note: I login using root user.

And then I run this command:

/db2/V10.1/bin/db2 connect to DBEMP

I got this error:

SQL1013N The database alias name or database name "DBEMP" could not be found. SQLSTATE=42705

Then I also run this command:

/db2/V10.1/bin/db2 list database directory

The result list doesn't have database named "DBEMP".


So what happened anyway?

If there is no database name exist, why IBM Data Studio can connect to it?

share|improve this question
1  
It appears you are referring to DB2 LUW. What are your connection details in Data Studio? –  WarrenT May 10 '13 at 11:06
    
some of it might be how you telnet into the remote box. Agree with Warren. Please provide more details on how you set up the connection in Data Studio and now it exists on the remote server and how you are connecting to both. –  Chris Aldrich May 10 '13 at 14:20
    
@all: yes, it's LUW. I had added more details in the question. –  suud May 13 '13 at 6:12
add comment

1 Answer

up vote 0 down vote accepted

Ahh....That has to do with profiles. Root was not set up by default to have DB2 libraries set up in its profile, so it doesn't recognize the DB2 executables. This is not to say root can't do what you are asking, you would just have to browse to the /instance/bin folder to find the executables you are after. Of course, then you have to worry about whether or not root has permission to connect....

But anyway, you might find it easier to sudo over to the id you want to use to connect (possibly even the instance) sudo - myid. For sure the instance will have DB2 set up in its profile. Your other ID you may have to set it up. Here is an answer I provided before where I showed someone how to set up DB2 for their profile.

I would recommend that you not give root DB2 access through its profile.

share|improve this answer
    
So did you mean I should login using user1 (instead of root) in the telnet session and only then I could connect to the database? –  suud May 13 '13 at 16:04
1  
I'm saying that root doesn't have DB2 set up in its profile. I don't know that user1 does either (it may or may not). You could try logging in as user1 and checking. If you don't have DB2 access you may need to navigate to your DB2 instance directory and invoke the db2profile script. Then you can use DB2. Make sense? –  Chris Aldrich May 13 '13 at 17:00
    
I tried login using user1 and it works. So I guess you're right that the root user doesn't has db2 profile set up, but I wonder where is the db2profile script for root, I can't found it since root doesn't has home directory (the db2profile is in /home/<user_name>/sqllib directory) –  suud May 15 '13 at 5:38
    
I don't believe you would want root running DB2, but if you really wanted to you could just execute the db2profile script. –  Chris Aldrich May 16 '13 at 12:46
    
Don't worry, I don't really want to do that. I'm just curious how to do it if it's really possible. The problem is (like I stated before) I can't find db2profile script for root, because root doesn't has home directory. Another user (like user1) has db2profile script resides in their home directory. Note: the OS is IBM AIX v7. –  suud May 16 '13 at 14:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.