DataSource - db2 with encrypted password

Hey I'm trying to connect to our db2 server and I got an error (bellow):

Can't establish connection to database
java.sql.SQLException: [ibm][db2][jcc][t4][201][11237] Connection authorization failure occurred.  Reason: Security mechanism not supported.
    at com.ibm.db2.jcc.c.b.i(b.java:1977)
    at com.ibm.db2.jcc.c.b.a(b.java:1571)
    at com.ibm.db2.jcc.c.bb.b(bb.java:3347)
    at com.ibm.db2.jcc.c.bb.a(bb.java:332)
    at com.ibm.db2.jcc.c.bb.a(bb.java:112)
    at com.ibm.db2.jcc.c.b.f(b.java:1363)
    at com.ibm.db2.jcc.c.b.b(b.java:1254)
    at com.ibm.db2.jcc.c.b.s(b.java:1024)
    at com.ibm.db2.jcc.c.b.b(b.java:639)
    at com.ibm.db2.jcc.c.b.a(b.java:625)
    at com.ibm.db2.jcc.c.b.a(b.java:363)
    at com.ibm.db2.jcc.c.b.<init>(b.java:299)
    at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:166)

I looked around and I found this: http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/cjvjcsec.htm

It seems that our corp server is configured to use encryption or something. I found another thread where s there somebody shared that they changed the connection properties and it worked, bellow is the quote. Hope all that would help you guys to figure out how to improve OUR BELOVED IDEA! :)

I work now in a very IBM like corp shop and I'm preaching IDEA to everybody around however - I feel that Idea needs to learn to communicate better with WebSphere and IBM's DB2 ...

Cheers,
Deian (old fan and user!)

---------

http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14281984

I was also getting the error:
"com.ibm.db2.jcc.b.SQLException: Connection authorization failure occurred.  Reason: security mechanism not supported".


To solve it, I changed my connection info to use encryption since it was required at the server. 
So I changed this:
myConn = DriverManager.getConnection(url, myuserid, mypassword);
to this:
Properties properties = new Properties();
properties.setProperty("securityMechanism",
Integer.toString(DB2BaseDataSource.ENCRYPTED_USER_AND_PASSWORD_SECURITY));          
properties.setProperty("user","myuserid");
properties.setProperty("password","mypassword");
myConn = DriverManager.getConnection(url, properties);

The format of the url did not need any changes.  It was formatted like this: 
url = "jdbc:db2://my.company.com:portnumber/DBNAME"
There are many other possible settings for "securityMechanism" so you may need to find the right one.
Here is a link to information which was very helpful for me:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/cjvjcsec.htm

1 comment

Dear Deian,

I've created http://youtrack.jetbrains.net/issue/IDEA-60094 for your case.

IDEA X data source UI (Advanced tab) already allows to specify connection properties.
See the next EAP for user defined properties.

Regards,
Gregory Shrago

On 18.10.2010 16:57, deian ivanov wrote:

Hey I'm trying to connect to our db2 server and I got an error (bellow):

>

Can't establish connection to database
java.sql.SQLException: [db2][jcc][t4][201][11237] Connection authorization failure occurred.  Reason: Security mechanism not supported.
     at com.ibm.db2.jcc.c.b.i(b.java:1977)
     at com.ibm.db2.jcc.c.b.a(b.java:1571)
     at com.ibm.db2.jcc.c.bb.b(bb.java:3347)
     at com.ibm.db2.jcc.c.bb.a(bb.java:332)
     at com.ibm.db2.jcc.c.bb.a(bb.java:112)
     at com.ibm.db2.jcc.c.b.f(b.java:1363)
     at com.ibm.db2.jcc.c.b.b(b.java:1254)
     at com.ibm.db2.jcc.c.b.s(b.java:1024)
     at com.ibm.db2.jcc.c.b.b(b.java:639)
     at com.ibm.db2.jcc.c.b.a(b.java:625)
     at com.ibm.db2.jcc.c.b.a(b.java:363)
     at com.ibm.db2.jcc.c.b.<init>(b.java:299)
     at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:166)

>

I looked around and I found this: http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/cjvjcsec.htm

>

It seems that our corp server is configured to use encryption or something. I found another thread where s there somebody shared that they changed the connection properties and it worked, bellow is the quote. Hope all that would help you guys to figure out how to improve OUR BELOVED IDEA! :)

>

I work now in a very IBM like corp shop and I'm preaching IDEA to everybody around however - I feel that Idea needs to learn to communicate better with WebSphere and IBM's DB2 ...

>

Cheers,
Deian (old fan and user!)

>

---------

>

http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14281984

>

I was also getting the error:
  "com.ibm.db2.jcc.b.SQLException: Connection authorization failure occurred.  Reason: security mechanism not supported".

>
>

  To solve it, I changed my connection info to use encryption since it was required at the server.
  So I changed this:
  myConn = DriverManager.getConnection(url, myuserid, mypassword);
  to this:
  Properties properties = new Properties();
  properties.setProperty("securityMechanism",
  Integer.toString(DB2BaseDataSource.ENCRYPTED_USER_AND_PASSWORD_SECURITY));          
  properties.setProperty("user","myuserid");
  properties.setProperty("password","mypassword");
  myConn = DriverManager.getConnection(url, properties);

>

  The format of the url did not need any changes.  It was formatted like this:
  url = "jdbc:db2://my.company.com:portnumber/DBNAME"
  There are many other possible settings for "securityMechanism" so you may need to find the right one.
  Here is a link to information which was very helpful for me:
  http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc/doc/cjvjcsec.htm

>

---
Original message URL: http://devnet.jetbrains.net/message/5275235#5275235


0

Please sign in to leave a comment.