Configure Squirrel SQL to connect to IBM DB2

"Squirrel SQL" is a great light weight generic SQL client that I have started using for more than 7 years now.

This is how to configure Squirrel SQL 3.3.0 to connect to DB2 server, I have installed IBM DB2 admin client 9.7 - 64 bit software on my Windows 7 enterprise SP1. You will find two types of DB2 drivers APP & NET, most recommended way is to use type 4 JDBC driver (thin) that actually doesn't require client installation, but require proper jar files and associated license.

1- Open Driver list from left menu, click the plus sign "Create a New Driver".
2- Type "IBM DB2 Universal Driver" in "Name" textbox.
3- Type "jdbc:db2://<server>:<port>/<dbname>" in "Example URL" textbox.
4- Type "com.ibm.db2.jcc.DB2Driver" in "Class Name" editable dropdown list.
5- Click "Extra Class Path" tab.
6- Click "Add" and select two jar files from %DB2_INSTALL%\java\db2jcc.jar & %DB2_INSTALL%\java\db2jcc_license_cu.jar
7- Click Ok, and we are done defining the driver.
8- Now create an alias for the DB using previous driver and providing URL, username, & password.

Your driver dialog should look like:


  1. How do you configure oracle driver for squirrel-sql-3.3.0?

  2. Thanks for these steps. i did it :)

  3. I get this error when I try to connect as above

    Error: DatabaseMetaData information is not known for server DB2/NTSQL09058 by this version of JDBC driver
    SQLState: null
    ErrorCode: -99999

    Do you know the reason?

    1. I have googled yr error, it seems some versions of DB2 client have some issues. I suggest u post yr question on IBM DB2 forum with exact versions of DB2 & Java

    2. I am facing the same error...

      Can you help me if you found something....
      I have installed new version of squirrel-sql.

    3. Try posting in this forum http://www.dbforums.com/db2/
      Please when you post, you need to mention exactly the following:
      1- Exact version of Operating system.
      2- Exact JDK version including (86 or 64) installed and used by SQuirrelSQL (Squirrel SQL is not your issue, i is between Java & DB2).
      3- Exact IBM DB2 client version

  4. Thank You Ashraf Fouad....!

    It's helped me...

  5. Hey thanks a lot. This was very very helpful

  6. Thanks for the wonderful set of steps to configure SQuirrelSQL with DB2.

  7. thanks for that post, v helpful

  8. Can I build the insert statements using the result of select statement ?

    1. This is one of the best useful features, here are the steps:
      1- Open a session to the DB you would like to retrieve data, and switch to the "SQL" tab.
      2- Write a SQL script to get the data you would like to have insert for, something like: select * from branch
      3- Highlight the above SQL statement.
      4- Click "Session" tab, select "Scripts", in sub-menu select "Create Data script from SQL".

      I hope this helps and sorry for delayed response.

  9. Replies
    1. Make it apple juice; I don't drink ;)

  10. Hello
    I've been trying to connect to our iSeries from Squirrel for hours and hours now. When I found your descrption I thougt hat's it, but it still doesn't work...

    The driver I configured as you described. The JAR files I have in C:\Programs\IBM\SQLLIB\java
    I guess this directory was installed as part of the iSeries Navigator or the Emulator...

    My problem is to connect to the database. What is the exact JDBC URL, which port do I need, which Database name...?

    I tried this:


    D0008488t is the database name as shown in the iSeries navigator. Is this the name I should use?
    Is port 8471 correct?

    When I try to connect it doesn't come back...

    I also tried to connect through the ODBC JDBC bridge. This basically works, but it the schema navigator it only
    shows my own library. I can't add any other schemes. This is why I wanted to try to connect using JDBC to
    see if this is a driver problem...

    1. I'm quoting from yr post "My problem is to connect to the database. What is the exact JDBC URL, which port do I need, which Database name...?"
      I think DB server name or IP & port & database name all this information you should have from your DBA.

      The strange here is that u can connect using ODBC, this means u have already created ODBC to DB2 which means u know above information !

      What is the error u r receiving?

    2. Well, to configure the ODBC connection I didn't need to specify neither the port nor the database name...

      I'm not sure about the port. I checked with WRKSRVTBLE that the as-database port is 8471, so I guess that's correct. Server IP and DB name indeed I know.

      When I try to connect I don't receive an error message. The dialog box displays "connecting..." and that's all, nothing further happens and Squirrel hangs.


    3. Your DBA should provide all details, if your ODBC didn't require such information, it seems it depends on the DB2 client installed in your machine, in this case ODBC requires DB alias only that is already linked.
      Anyway, I have no previous experience in iSeries, but I think think link can get you the required information http://knowledgebase.progress.com/articles/Article/000028707

  11. Thanks for your quick answers. I actually didn't expect any answers in this year anymore...
    I thought I was the only one sitting in the office and working today :-)

    The knowledge base article indeed helped me. In another IBM document I found that the service for JDBC is "as-database", but actually it's "drdb", which on our system listens on port 446.

    Now I get another error message that the license couldn't be found in the class path. Well, this is something I can check.

    Thanks again for your quick help.


  12. I configured DB2 to support SSL. When I try to connect Squirrel client with DB2, I get below error:

    java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2043][11550][4.16.53] Exception java.net.ConnectException: Error opening socket to server / on port with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001

    Please help me to connect Squirrel SQL client with DB2 SSL enabled((DB2COMM=SSL)).

  13. This comment has been removed by the author.

  14. I get the following error when I try to connect server from Alias in Squirrel SQL client...any solutions would be appreciated...thanks in advance

    java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2043][11550][3.59.81] Exception java.net.ConnectException: Error opening socket to server / on port 50,004 with message: Connection timed out: connect. ERRORCODE=-4499, SQLSTATE=08001
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.RuntimeException: com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2043][11550][3.59.81] Exception java.net.ConnectException: Error opening socket to server / on port 50,004 with message: Connection timed out: connect. ERRORCODE=-4499, SQLSTATE=08001
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:171)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$000(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$1.run(OpenConnectionCommand.java:104)
    ... 5 more
    Caused by: com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2043][11550][3.59.81] Exception java.net.ConnectException: Error opening socket to server / on port 50,004 with message: Connection timed out: connect. ERRORCODE=-4499, SQLSTATE=08001
    at com.ibm.db2.jcc.am.dd.a(dd.java:319)
    at com.ibm.db2.jcc.am.dd.a(dd.java:337)
    at com.ibm.db2.jcc.t4.wb.a(wb.java:400)
    at com.ibm.db2.jcc.t4.wb.(wb.java:78)
    at com.ibm.db2.jcc.t4.a.y(a.java:317)
    at com.ibm.db2.jcc.t4.b.a(b.java:1801)
    at com.ibm.db2.jcc.am.jb.a(jb.java:588)
    at com.ibm.db2.jcc.am.jb.(jb.java:540)
    at com.ibm.db2.jcc.t4.b.(b.java:303)
    at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:214)
    at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:456)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:167)
    ... 7 more
    Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.ibm.db2.jcc.t4.x.run(x.java:34)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.ibm.db2.jcc.t4.wb.a(wb.java:386)
    ... 17 more

    1. It is quite obvious it is not a problem in squirrel SQL but in DB2 connection, please refer to https://www-304.ibm.com/support/docview.wss?uid=swg21403644

      I don't think IBM suggestion will work unless this DB2 instance is new and no-one connected to it before, and actually it is a silly mistake to DBA to make it, can you please check you opened proper connection to DB2 port and it is working?

  15. Gracias, funcionó de maravilla.

  16. AOA:
    I am having issues in connecting DB2 database. I can connect via SQL Developer and Toad Data Point, so I have correct credentials and connection strings. I tried to use these drivers but not success...

    I have Win 7 32bit
    Java 1.7
    SQuirrel Build_2231

    I am seeing this error:
    Could not find class com.ibm.db2.jcc.DB2Driver in neither the Java class path nor the Extra class path of the IBM DB2 Universal Driver driver definition:
    java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver

    The Driver name is not showing Checked either.

    I will appreciate your help.


    1. Dear Irfan,
      Wa Alekom Al Salam Wa Rahmato Allah Wa Barkato, after a small invistigation I found this link showing the difference between db2jcc4.jar vs db2jcc.jar

      So it seems that both have the same classes within the jar, and I thnk if you are trying to include all 3 jars

      when u specify extra CLASSPATH you will get Java confused to determine the jar having the correct implementation of "com.ibm.db2.jcc.DB2Driver"

      My recommendation will be just follow the steps in the post and only use the 2 mentioned jars, then In Shaa Allah you will find check next to driver name.

    2. Dear Ashraf, Salamun Alekum
      Sorry for being late in reply. I am using only two JAR files at a time *license* and one of other, NOT all three. I am not getting checked by using any combination. Just to let you know that I am able to connect to DB2 via "Oracle SQL Developer" using same JAR files. Thanks for your help

    3. The error is very clear that it can't find the class so it is not being able to reach the jars. What is your complete path of the jar files? Does it contain spaces?

      Please paste the location or screen shot of your setup.

    4. Thanks Ashraf,
      I am finally able to connect to DB2. I had to use "db2jcc_license_cu.jar and db2jcc4.jar" combination for JAR files. I can run query but cannot see schemas/tables. I had same issue in SQL Developer as well and I got following error in there. It looks like permission issue as my user does not have permission on "SYSCAT.SCHEMATA" table. I know you are not suppose to resolve it but I thought you might encounter this type of issue before and have any work around. Please note that my coworker has Toad for Data Point and he is able to connect to same DB2 with same credential and see all schemas. Thanks again for nice article and quick replies.

      An error was encountered performing the requested operation:


      Vendor code -204

    5. Happy that u started working.

      This is more DB2 related question, I didn't use DB2 since long back, you can either search the internet to find the error, or if you have question, I think this forum was of great help to me answering questions before and might help u:


      I advice to register & post yr question if u didn't find yr answer

  17. Thanks man, this is still really useful, even in 2016.

  18. Nice to see your post, this is a great platform to get some useful information and facts!


  19. Thank you! This worked like a charm! I was able to do this while sitting in a meeting -- that's when you know a guide was written very well!