Creating a DB2 Data Source in Ultimate 12.1.4

I'm at a loss as to how to proceed here.   I'm using IntelliJ IDEA 12.1.4 Ultimate (using the Ultimate features for the first time), trying to connect to our AS400 DB2 system to create a Data Source (the ultimate goal is to create some POJOs from existing DB2 tables).   

I downloaded the DB2 connector jar "db2jcc4-4.9.78.jar" and added the connection URL and username/password information, but when I click "Test Connection" I get this:

Connection to Data Source failed
java.sql.SQLException: [jcc][t4][2095][11230][4.7.85] Security mechanism requested is not supported by server. ERRORCODE=-4450, SQLSTATE=0A502
 at com.ibm.db2.jcc.am.dd.e(dd.java:605)
 at com.ibm.db2.jcc.am.dd.d(dd.java:633)
 at com.ibm.db2.jcc.t4.b.a(b.java:1587)
 at com.ibm.db2.jcc.t4.bb.b(bb.java:3399)
 at com.ibm.db2.jcc.t4.bb.a(bb.java:332)
 at com.ibm.db2.jcc.t4.bb.a(bb.java:112)
 at com.ibm.db2.jcc.t4.b.m(b.java:1240)
 at com.ibm.db2.jcc.t4.b.b(b.java:1113)
 at com.ibm.db2.jcc.t4.b.d(b.java:700)
 at com.ibm.db2.jcc.t4.b.c(b.java:686)
 at com.ibm.db2.jcc.t4.b.a(b.java:375)
 at com.ibm.db2.jcc.t4.b.<init>(b.java:311)
 at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:214)
 at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:224)
 in RemoteDriverImpl.connect(RemoteDriverImpl.java:27)
 in LocalDataSource.getConnection(LocalDataSource.java:158)


After some Googling I added the following in the "Advanced" tab:

securityMechanism = 13

I got the value "13 from this link:   http://www-01.ibm.com/support/docview.wss?uid=swg21284811
This should be the equivalent of  securityMechanism=DB2BaseDataSource.ENCRYPTED_USER_PASSWORD_AND_DATA_SECURITY.

Then I got this error:

Connection to Data Source failed
java.sql.SQLException: [jcc][1071][10615][4.7.85] Caught java.security.InvalidAlgorithmParameterException while initializing EncryptionManager.  See attached Throwable for details. ERRORCODE=-4223, SQLSTATE=null
 at com.ibm.db2.jcc.am.dd.a(dd.java:660)
 at com.ibm.db2.jcc.am.dd.a(dd.java:60)
 at com.ibm.db2.jcc.am.dd.a(dd.java:85)
 at com.ibm.db2.jcc.am.pc.a(pc.java:152)
 at com.ibm.db2.jcc.t4.b.fd(b.java:2397)
 at com.ibm.db2.jcc.t4.b.d(b.java:732)
 at com.ibm.db2.jcc.t4.b.c(b.java:686)
 at com.ibm.db2.jcc.t4.b.a(b.java:375)
 at com.ibm.db2.jcc.t4.b.<init>(b.java:311)
 at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:214)
 at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:224)
 in RemoteDriverImpl.connect(RemoteDriverImpl.java:27)
 in LocalDataSource.getConnection(LocalDataSource.java:158)
Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive)
 at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DashoA13*..)
 at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:627)
 at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:369)
 at com.ibm.db2.jcc.am.pc.a(pc.java:141)
 at com.ibm.db2.jcc.t4.b.fd(b.java:2397)
 at com.ibm.db2.jcc.t4.b.d(b.java:732)
 at com.ibm.db2.jcc.t4.b.c(b.java:686)
 at com.ibm.db2.jcc.t4.b.a(b.java:375)
 at com.ibm.db2.jcc.t4.b.<init>(b.java:311)
 at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:214)
 at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:224)
 in RemoteDriverImpl.connect(RemoteDriverImpl.java:27)


So it seems that I am connecting to the server, and it likes the securityMechanism, but it's erroring on this:   java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive)

Can anybody help me with this or at least suggest where I can go to look for answers?   

1 comment
Comment actions Permalink

Found the answer:   I was using the  jar "db2jcc4-4.9.78.jar" recommended by IDEA, and a URL in the form

jdbc:db2://myserver/mydatabase

But because my database is on an IBM AS400 (sometimes referred to as an "iSeries") I needed to use the following jar and URL format:

Jar:     jt400-6.6.jar

URL:   jdbc:as400://myserver/mydatabase

I hope this helps somebody.  

0

Please sign in to leave a comment.