Using SQL Developer to Interact with Db2

Summary: in this tutorial, you will learn how to interact with Db2 database servers using the SQL Developer tool.

SQL Developer is a free Database IDE that allows you to interact with databases using a graphical user interface instead of command-line tools like Db2 command line or Db2 command line plus. In the past, SQL Developer solely supported Oracle Database. However, by using third party plugins, you can use SQL developer to work with other database systems such as MySQL, SQL Server, or IBM Db2.

Download SQL Developer

Click the following link to download the SQL Developer program.

Download SQL Developer

Note that you need to create an Oracle account in case you don’t have one before you can download it.

Download Plugin

Click the following link to download the JDBC Db2 driver version:

Download JDBC DB2 driver

Connect to Db2 Using SQL Developer

Launch SQL Developer and follow these steps:

Step 1. Choose Tools > Preferences… menu item:

Step 2

Search for JDBC, you will find the Third Party JDBC Drivers under Database. Click the Add Entry… button

Step 3

Browse to the location that you store the JDBC driver file, in this case, it is db2jcc.jar under d:\software directory. Click the Select button to choose the JDBC driver file and click the OK button to accept the JDBC driver.

Step 4

Click the New button to create a connection to the Db2 database server.

Step 6

Choose the database connection and click the OK button

Step 7

  1. Click the DB2 tab
  2. Provide the connection details including connection name, user, password, hostname port, and the database (Books) that you want to connect.
  3. Click the Test button to test the connection. If you see the status: success, it shows that the connection is fine.
  4. Click the Save button to save the connection and then click the Connect button to connect to the Books database on the local DB2 database server.

Step 8

You will see the following query editor.

Enter the following command and click the Run button, you will get the output:

In this tutorial, you have learned how to use the SQL Developer to interact with a database on the Db2 database server.

Was this tutorial helpful ?