Search code examples
windowsdb2admin

What is the cause of this error in IBM DB2


I installed IBM DB2 Express C Version 10.5.4 and have been unable to use any commands in the Command line processor. The commands I've tried include 'connect to sample' and 'list database directory'. I get the following error message every time:

SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031

I was told that to check if the installation of DB2 was done correctly, I'd be able to test it using DBeaver, and so I did. As expected, I can't Test Connection using DBeaver either. I get the following error message:

SqLException

I've attached detailed images of the problem as well.

The reason I'm using DB2 instead of MySQL is because my Uni is using DB2, so I have no other choice but to use DB2 as well.

Some troubleshooting I've done myself include

  1. Uninstalling and reinstalling both IBM DB2 and DBeaver
  2. Running the DB2 Command Line Processor as Administrator
  3. Reinstalling IBM DB2 in the D drive (instead of the default directory in the C drive)

None of the above seem to solve my issue at all. I'm currently using Windows 11. All of my classmates had no problem installing and running both DB2 and DBeaver.


Solution

  • The message is telling you that no Db2-database has been created as yet.

    After a Db2-database is successfully created or a remote database catalogued, then the database directory will exist, and in the Db2 CLP the command list database directory will show which database(s) are created/catalogued.

    The most likely cause is that you made some omission or mistake during installation, or did not closely follow all the instructions.

    To create a Db2-database, on Microsoft-Windows with the Db2-server already running locally, try these steps:

    • start > Run > db2cwadmin.bat (and click yes to the elevation prompt). Notice this is a different tool from the DB2 CLP.
    • in the resulting db2cmd window that will open, enter the command db2sampl and wait for it to complete without errors. It may take a few minutes and the disk will be busy.

    When there are no errors, the SAMPLE database should now accept connections from either the Db2-clp, or from DBeaver(you may need to close and reopen the Db2 clp window first).

    When you get errors, do not post images, instead edit your question and post the plain text. Images are not searchable, and not readable on some devices, that is the reason you should use plain text instead.