I installed DB2 Express 10.1 on my Windows 7 (64bit) notebook. Now after the installation finished I cannot connect to the database. During the installation I specified "C:\Daten\db\db2" as the directory to be used for DB2.
When trying to connect, I get the following error:
SQL1031N The database directory cannot be found on the indicated file system.
However the database seems to be there:
db2 => connect to db2inst
SQL1031N The database directory cannot be found on the indicated file system.
SQLSTATE=58031
db2 => list database directory
System Database Directory
Number of entries in the directory = 1
Database 1 entry:
Database alias = DB2INST
Database name = DB2INST
Local database directory = C:\Daten\db\db2\IBM\DB2\DB2INST
Database release level = f.00
Comment =
Directory entry type = Indirect
Catalog database partition number = -1
Alternate server hostname =
Alternate server port number =
I verified that the file system privileges are correct for the directory (the user running the DB2 service has full control on that directory and I made him the owner as well).
The content of C:\Daten\db\db2\
looks like this:
\---IBM \---DB2 \---DB2INST +---cfg +---cfgcache +---DB2 | +---ctrl | +---hmonCache | | \---DB2 | | \---0 | | \---ossipcres | +---log | +---security | | \---auditdata | +---spmlog | | \---SPMLOGSD | +---SQLDBDIR | +---TMP | \---UIF +---DB2DAS00 | +---cfg | +---dump | +---log | +---metadata | \---tmp | +---dastmp | \---schedtmp +---db2dump +---function | \---unfenced \---license
I then tried to re-catalog the database:
db2 => uncatalog database db2inst DB20000I The UNCATALOG DATABASE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. db2 => catalog database db2inst on "c:\Daten\db\db2\IBM\DB2\DB2INST\" DB20000I The CATALOG DATABASE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed.
But that didn't help either.
For some reason it seems DB2 can't access the (existing) directory:
db2 => list db directory on "c:\Daten\db\db2\IBM\DB2\DB2INST\" SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031 db2 => list database directory
I'm not experience with DB2 and the last time I installed Express everything went smoothly, so I'm a bit lost now.
-
@algorian asks "From your post, I understand that you installed the DB2 and immediately wanted to connect your database. So, when and how did you create that database you want to connect to?"Martin Smith– Martin Smith2012年10月30日 07:49:22 +00:00Commented Oct 30, 2012 at 7:49
2 Answers 2
If you built your database at C:\Daten\db\db2\IBM\DB2, then that should be your path for your database directory. (ie, it should be one higher than where your database resides).
Also, just wondering what command you used when you built your database? Where did you specify that it lives?
-
Thanks for the answer. I was asked during the setup wizard where I wanted to store the database files. I don't remember the exact screen though. It seems that the effect of the
catalog database
command only takes effect when DB2 is restarted. After that I could access the default database.user1822– user18222012年07月02日 17:05:08 +00:00Commented Jul 2, 2012 at 17:05 -
@a_horse_with_no_name actually you only need to issue
db2 terminate
in order to makecatalog
anduncatalog
commands take effect.Chris Aldrich– Chris Aldrich2012年07月02日 21:47:00 +00:00Commented Jul 2, 2012 at 21:47
Similar problem was solved by the following steps:
- open DB2 "command window - Administrator"
db2stop
db2set DB2COMM=tcpip
3.1. optional
db2set DB2_CREATE_DB_ON_PATH=YES
db2 CATALOG ADMIN TCPIP NODE {your_node_name} REMOTE {host_name} SYSTEM {system_name} OSTYPE {your_os_type_code}
db2start
-
It is an attempt to catalog (ie, recognize) the database by accessing it via TCP/IP rather than local file system. The thought is to get DB2 to call out to the database as if it were remote when it isn't. Upside is it probably works. Downside is you now have to worry about node configurations to get DB2 to see your database. Usually you only do this if the database you are targeting is on separate LPAR or physical box than the instance or client where you are working.Chris Aldrich– Chris Aldrich2012年11月08日 16:52:40 +00:00Commented Nov 8, 2012 at 16:52