I've followed this simple guide and I was able to install DB2 on Docker.
I now would like to import a sample database 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 this solution 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?
1 Answer 1
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.
-
Thank you @Lennart, what do you think about the dot?Francesco Mantovani– Francesco Mantovani2022年06月02日 13:28:21 +00:00Commented Jun 2, 2022 at 13:28
-
I have not used Data Studio, so I'm afraid I don't know what it looks like when it's working.Lennart - Slava Ukraini– Lennart - Slava Ukraini2022年06月02日 13:36:14 +00:00Commented Jun 2, 2022 at 13:36
-
Do you use another GUI client or you just import databases from .sql files form command line? I'm asking because I'm testing the performances. Creating the SAMPLE database took minutes and I already tested that on 2 different machines. I'm talking about DB2 into a docker containerFrancesco Mantovani– Francesco Mantovani2022年06月02日 13:50:45 +00:00Commented Jun 2, 2022 at 13:50
-
1It becomes to long for a comment, I'll update my answerLennart - Slava Ukraini– Lennart - Slava Ukraini2022年06月02日 16:38:31 +00:00Commented Jun 2, 2022 at 16:38
Explore related questions
See similar questions with these tags.