1

I have a problem in establishing DB2 connection with wrong user-name/password. We have an application which runs on LAN on many systems using DB2 database located on my system as well as other systems.

Firstly I use this URL to create other system DB2 connection:

Connection con = DriverManager.getConnection("jdbc:db2://Rahulkcomputer:50000/XAN4", "rahulk", "dbirs#35");

this returns proper Connection object. Now when I change the URL to access my system DB2 connection with same user-name/password as (using same user-name/password is intensely done for checking error handling):

Connection con = DriverManager.getConnection("jdbc:db2://127.0.0.1:50000/XAN4", "rahulk", "dbirs#35");

This time it again returns the Connection object instead of throwing an SQLException specifying wrong user-name/password (due to my system's DB2 authentication is totally different from Rahulkcomputer's system)

After getting connection, I execute this query to check proper user name as explained in post:

Simple DB2 Query for connection validation

SELECT CURRENT SQLID FROM SYSIBM.SYSDUMMY1

(this returns "rahulk" in both cases)

Why DB2 created connection in 2nd case with wrong user-name/password (moreover when we close all the services of DB2 on Rahulkcomputer, even then I get the connection in 2nd case)?

Thanks in Advance.

Community
  • 1
  • 1
Kishore
  • 41
  • 1
  • 1
  • 6
  • Did you verify that you can actually insert data with that connection and if so, which computer the data lands on? Are you sure your compiled your .java files before executing your code? – Joachim Sauer Mar 07 '11 at 07:54
  • Hi Joachim Sauer, Actually the connection made in 2nd case, does not allow to run any query, also it throws SQL Exception SQLCODE=-204, SQLSTATE=42704. My question is, If no query can be executed,then why connection is being created? Yes. I compiled my .java files before executing the code. Please give specific answer, If you know. Thanks in advance. – Kishore Mar 09 '11 at 05:08
  • Have I posted under wrong Tags due to not getting any leads?? Please specify. – Kishore Mar 04 '11 at 06:59

1 Answers1

1

You either created your database with the restrictive option or revoked the select right to sysibm from PUBLIC. The connection you had was fine, the access rights not. 42704 is DB2's way of saying "huh?", it did not recognize sysibm because you had no rights to see it.

user918176
  • 1,770
  • 13
  • 34
  • If an ID doesn't have authority to access SYSIBM.SYSDUMMY1, the query above would not get the SQL0204N ("object not found"), it would get SQL0551N ("ID does not have required authorization or privilege"). If the failure was actually SQL0204N, that would imply that SYSIBM.SYSDUMMY1 does not exist on the system. – Ian Bjorhovde Dec 16 '12 at 16:00
  • That would happen only if the installation was seriously botched. Not re-binding all the default packages when installing fixpack for instance could do that, but still it's unlikely? – user918176 Dec 16 '12 at 17:43