Menu

#541 Cannot connect to DB2 DataSource ... SOAPUI 3.5 Pro Beta

open
nobody
general (369)
5
2010-02-15
2010-02-15
Munaf Sahaf
No

I am trying to establish connection to DB2 using "COM.ibm.db2.jdbc.app.DB2Driver", i get the following exception when i click on TestConnection:

"Can't get the Connection for specified properties; java.lang.Exception: Failed to init connection for drvr [COM.ibm.db2.jdbc.app.DB2Driver], connectionString [jdbc:db2://server:port/myDB?user=myuser&password=#####]"

Which might imply the classpath is wrong but if i try to click on ->configure-> OK -> Build Query (YES) -> i get following exception...
"Failed to connect to database: No suitable driver found for jdbc:db2://server:port/DataBase?user=myuser&password=mypassword"

Which implies that URL is wrong for the driver specified ("COM.ibm.db2.jdbc.app.DB2Driver").

Looking at the class -- java.com.eviware.soapui.support.jdbc.JdbcUtils ( if this is the one creating connections) we are trying to use DriverManager.getConnection( connStr ); and the URL is not accepted by "COM.ibm.db2.jdbc.app.DB2Driver" which should be DriverManager.getConnection( connStr, "user", "password" ); where connStr should be jdbc:db2://myDatabase (type 2 coz of driver COM.ibm.db2.jdbc.app.DB2Driver)

Discussion

  • Dragica Soldo

    Dragica Soldo - 2010-02-16

    Hi,

    If I understand you did manage to get through with DriverManager.getConnection( connStr, "user", "password" ); for connStr "jdbc:db2://myDatabase" (I assume with some of your java classes), right?Please try connecting from SoapUI by directly specifying connStr = dbc:db2://myDB?user=myuser&password=pass in connstr field, i.e. skipping server and port. Is that working?

    Regards,
    /Dragica
    eviware.com

     
  • Dragica Soldo

    Dragica Soldo - 2010-02-16

    Sorry, missed a letter
    connStr = jdbc:db2://myDB?user=myuser&password=pass, leave "Password" empty and specify the value in connstr directly

    Regards,
    /Dragica
    eviware.com

     
  • Munaf Sahaf

    Munaf Sahaf - 2010-02-16

    Hi Dragica,

    Forgot to mention i did try with connStr = jdbc:db2:myDB?user=myuser&password=mypassword, that didn't work and in java

    java.sql.Driver d = (java.sql.Driver)Class.forName( drvr ).newInstance();
    System.out.println(d.acceptsURL(connStr)); --- return false for that url too...

    Thanks for quick response...

     
  • Anonymous

    Anonymous - 2010-02-16

    Hey guys. I got this to connect to DB2 in the 3.5 open source nightly build:

    * Copied DB2 jars to soapui/ext/bin
    * Used the type 2 driver: com.ibm.db2.jcc.DB2Driver
    * Used the following connecting string format: jdbc:db2://sysmvs1.stl.ibm.com:5021/san_jose:user=db2adm;password=db2adm;

    It also works in 3.5 pro if you stay away from the 'guided' GUI screens. I'm sure with some tweaking they would work though.

    This works Awesome...thanks for the post

     

    Last edit: Anonymous 2016-01-22
  • Dragica Soldo

    Dragica Soldo - 2010-02-17

    Hi,
    @Munaf, please try connecting with your existing driver by manually setting conn string to
    jdbc:db2://server:port/myDB:user=myuser;password=mypass
    (instead of jdbc:db2://server:port/myDB?user=myuser&password=mypass).
    Leave Password input field empty and simply add password value to the end of connstr.
    Please let me know if this helps so that I change the configuration of connection string in the wizard.
    @Adavis thank you very much for the tip.

    Regards,
    /Dragica
    eviware.com

     
  • Nobody/Anonymous

    This worked

     
  • Munaf Sahaf

    Munaf Sahaf - 2010-02-17

    Thanks Adavis it worked with "com.ibm.db2.jcc.DB2Driver".

    @Dragica it is not working with "COM.ibm.db2.jdbc.app.DB2Driver", COM.ibm.db2.jdbc.app.DB2Driver is a type 2 driver and it doesn't support type 4, so it won't take server:port. I am gonna use JCC type 4 driver as suggested by Adavis.

     

Log in to post a comment.