DB2 on Docker :: IBM Data Studio prompts error when creating new database
-
I've followed https://ajstorm.medium.com/installing-db2-on-your-coffee-break-5be1d811b052 and I was able to install DB2 on Docker.
I now would like to import a https://dataedo.com/kb/databases/db2/sample-databases to play with.
So I open IBM Data Studio, I right click on the instance > New database... , I fill up with my user name and password but then an error appears:
The system cannot verify the instance that you specified. Either enter a valid instance name or click on the button next to the Instance name field and select one from the list. com.ibm.datatools.adm.explorer.ui.model.InstanceException: An internal error occurred during: "Verifying instance db2inst1 in system 192.168.1.44.".
If I expand the error for more details I see:
'Verifying instance db2inst1 in system 192.168.1.44.' has encountered a problem.
An internal error occurred during: "Verifying instance db2inst1 in system 192.168.1.44.".
An internal error occurred during: "Verifying instance db2inst1 in system 192.168.1.44.".
com.ibm.db2.das.core.DasMessageIdentifier (initialization failure)
A dive in the official documentation brings me to https://www.ibm.com/support/pages/db2-installation-completes-error-error-occurred-while-creating-instance-db2inst1-return-code-1 but I don't think that could be the problem.
What intrigues me is the 'dot' (
.
) after the IP address. Could this be the error?Or is there any other way to import a sample database from IBM Data Studio?
-
The easiest way to create a sample database is to login to the container:
~]$ docker exec -ti mydb2 bash -c "su - db2inst1"
Once inside the container:
[db2inst1@e88eefa89d92 ~]$ db2sampl
Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema "DB2INST1"...'db2sampl' processing complete.
[db2inst1@e88eefa89d92 ~]$ db2 list db directory
System Database Directory
Number of entries in the directory = 1
Database 1 entry:
Database alias = SAMPLE
Database name = SAMPLE
Local database directory = /database/data
Database release level = 15.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
If you don't want to use the sample database provided via db2sampl, you can create a database as part of the start of the container via
-e DBNAME=MYSAMPLE
:docker run -itd --name mydb2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=whatever ibmcom/db2 -e DBNAME=MYSAMPLE
Now you can try to connect to that database from data studio, setup your tables and inserting data.