Showing posts with label DB2 LUW. Show all posts
Showing posts with label DB2 LUW. Show all posts

Connect MS Access to DB2 Express C

Working with DB2 Express C for a while I tried to explore a way through which I can connect any front end application and see if I can get a breakthrough with the native DML's I was performing on the DB2 CLP administrator window on my DB2 tables.

Easiest of all connections to DB2 is through Microsoft Access.

Here are the steps through which you can connect to the database :

Step 1 : Launch the MS Access and create a sample database
Step 2 : On the External Data tab choose ODBC database with second bullet option which gives you a two way interface to your DB2 database / Any database for that matter
Step 3 : Select Machine Data Source, Click New
Step 4 : Create a new data source tab, Choose System Data Source and Click Next
Step 5 : Choose the IBM DB2 ODBC Driver - DB2COPY1, Click Next & Finish
Step 6 : Provide a datasource name of your choice and click OK
Step 7 : Double Click on the datasource name that was just created using the above driver
Step 8 : The connection to DB2 will now be established and you will be able to see all the tables under the database you created the DSN on
Step 9 : Use MS-Access as a front end appliance for your DB2 database

Easy to install, Easy to use. The data you feed into MS-Access directly replicates on the DB2 data server, the only draw back is - the refresh wouldn't work and you will not see data changes when someone updates your database untill and unless you close and re-establish the connection, I am still trying to figure out a way if its possible.

DB2 10.1 Express C - How to fix your expired license

DB2 10.1 Express C - free to download, deploy and use is an ultimate  database server if you want to spend some time learning DB2, try the  windows 64 bit version available for free download here.

The software is free for a life time as said in the website, but there are situations you face when anything can go wrong, even the licensing

db2 => start dbm
SQL8000N DB2START processing failed; a valid product license was not found. If you have licensed this product, ensure the license key is properly registered. You can register the license using the db2licm command. The license key can be obtained from your licensed product CD

As seen above, the error clearly states that, a valid product license was not found. Now all the while for over 2 months this worked perfectly fine. All of a sudden the start database manager command wouldn't work. I did have a word with my buds regarding this and this could have possible happened due to a packaging issue with the software when it was hosted on the web ; ready for download. 

To confirm the license has expired I issued the following command : 

C:\Program Files\IBM\SQLLIB\BIN>db2licm -l
Product name:                     "DB2 Express-C"
License type:                     "Unwarranted"
Expiry date:                      
“expired"
Product identifier:               "db2expc"
Version information:              
"10.1"
Max number of CPUs:               "2"
Max amount of memory (GB):        "16"
Enforcement policy:               "Soft Stop"
How do you go about fixing this ?

With a lot of reading and surfing the web day in an day out I found that under the C:\Program Files\IBM\SQLLIB\BIN folder there exists a hidden folder by the name .licbkp 

Now if we open the folder ( after enabling view hidden folders from the control panel ) we will notice a file by the name : lic00000001.lic

This is your license file, simply copy it to this location C:\Program Files\IBM\SQLLIB\BIN and issue the following command to bring DB2 back to life : db2licm –a \lic00000001.lic

C:\Program Files\IBM\SQLLIB\BIN>db2licm -a \lic00000001.lic

LIC1408N  The file "C:\lic00000001.lic" could not be opened. Enter the name of a file that exists and can be opened and try the command again.

Copied the license file to C:\ and tried again, it is easy this way for me as I now know where my license file resides, you can specify the direct path on the db2licm command too

C:\Program Files\IBM\SQLLIB\BIN>db2licm -a \lic00000001.lic

LIC1402I  License added successfully.

LIC1426I  This product is now licensed for use as outlined in your License Agreement.  USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, LOCATED IN THE FOLLOWING DIRECTORY: "C:\PROGRA~1\IBM\SQLLIB\license\en"

Please note that this location may vary if you are on a different version on windows, I was on windows 7 when I got this error.

Issue the db2licm - l command again :

C:\Program Files\IBM\SQLLIB\BIN>db2licm -l
Product name:                     "DB2 Express-C"
License type:                     "Unwarranted"
Expiry date:                      
"Permanent"
Product identifier:               "db2expc"
Version information:              
"10.1"
Max number of CPUs:               "2"
Max amount of memory (GB):        "16"
Enforcement policy:               "Soft Stop"