Results 1 to 5 of 5
  1. #1
    Join Date
    May 2016
    Posts
    3

    Answered: I am unable to connect to the database

    Hi,

    I am a fresher to DB2. I habve installed the DB2 SERVER edition. Now I want to connect to the DB. I am opening the CLP Plus and doing the below activity:
    SQL> connect
    Enter DATABASE NAME [SAMPLE]:
    Enter HOSTNAME [localhost]:
    Enter Port [50000]:
    Enter ID: db2admin
    Enter password: *******

    But I an getting the below exception.

    [jcc][t4][10262][11223][3.69.49] Unexpected Throwable caught: null.
    ERRORCODE=-4228, SQLSTATE=null

    Please can you guide me to connect to the database.

  2. Best Answer
    Posted by db2mor

    "You seem to be using the db2jcc.jar (jdbc 3.0) driver that comes with DB2 V10.5 fixpack 7.

    Post the the operating-system name and version and bitness. I assume it is some version of Windows because you mention db2admin.

    Post which edition of the DB2 product you installed: community edition,personal edition, enterprise etc.

    You are trying to use the clpplus interface to DB2, but that is only one interface, other interfaces are available. clpplus uses java to connect.

    If the operating-system is Windows, try temporarily ignoring clpplus and instead try running db2cwadmin.bat which opens a db2cmd.exe window. That is another command-line interface to DB2. This does not use java or TCP/IP. When that window opens try the command: db2 connect to sample user db2admin . That depends on the DB2-server product being started already. It will ask you for the password. If the connection succeeds, you know that your DB2 is working. You can enter commands and SQL at the command line but most new starters prefer to use a GUI tool to work with DB2(there are many such tools, some are free, others cost money).


    The connect from any java application (like clpplus , or Data Studio , or DB-visualizer etc), the DB2-instance needs to be configured to listen on the port-number you specified (database manager configuration SVCENAME) , and the DB2-registry variable DB2COMM must have a value that includes TCPIP (search db2set command).
    Once your DB2-instance is listening on the correct port and enabled for TCPIP, then connections from java applications should work and you should try to use the type-4 jdbc driver (db2jcc4.jar).

    For more details on each of these things, search in the DB2 Knowledge Centre on line at:
    http://www.ibm.com/support/knowledge...e.html?lang=en

    Learn from there."


  3. #2
    Join Date
    Apr 2012
    Posts
    1,006
    Provided Answers: 16
    You seem to be using the db2jcc.jar (jdbc 3.0) driver that comes with DB2 V10.5 fixpack 7.

    Post the the operating-system name and version and bitness. I assume it is some version of Windows because you mention db2admin.

    Post which edition of the DB2 product you installed: community edition,personal edition, enterprise etc.

    You are trying to use the clpplus interface to DB2, but that is only one interface, other interfaces are available. clpplus uses java to connect.

    If the operating-system is Windows, try temporarily ignoring clpplus and instead try running db2cwadmin.bat which opens a db2cmd.exe window. That is another command-line interface to DB2. This does not use java or TCP/IP. When that window opens try the command: db2 connect to sample user db2admin . That depends on the DB2-server product being started already. It will ask you for the password. If the connection succeeds, you know that your DB2 is working. You can enter commands and SQL at the command line but most new starters prefer to use a GUI tool to work with DB2(there are many such tools, some are free, others cost money).


    The connect from any java application (like clpplus , or Data Studio , or DB-visualizer etc), the DB2-instance needs to be configured to listen on the port-number you specified (database manager configuration SVCENAME) , and the DB2-registry variable DB2COMM must have a value that includes TCPIP (search db2set command).
    Once your DB2-instance is listening on the correct port and enabled for TCPIP, then connections from java applications should work and you should try to use the type-4 jdbc driver (db2jcc4.jar).

    For more details on each of these things, search in the DB2 Knowledge Centre on line at:
    http://www.ibm.com/support/knowledge...e.html?lang=en

    Learn from there.

  4. #3
    Join Date
    May 2016
    Posts
    3

    thanks

    Thanks sir!
    As you correctly pointed out I am using the db2jcc.jar (jdbc 3.0) driver that comes with DB2 V10.5 fixpack 7.
    I am using windows operating system(Windows 10). I have installed the DB2 V10.5 fixpack 7 enterprise edition.
    While I try to running db2cwadmin.bat another window db2cmd.exe window opens, and upon issuing the command db2 connect to sample user db2admin I am unable to connect.

  5. #4
    Join Date
    Apr 2012
    Posts
    1,006
    Provided Answers: 16
    The first version of DB2 that IBM will support on Windows 10 will be Version 11.1

    When you try the connect in db2cmd.exe, what is the fail message exactly ?

    You can search more information in db2diag.log

  6. #5
    Join Date
    May 2016
    Posts
    3

    windows 10 connectivity

    It absolutely makes sense.
    I checked for the resolution of the error code in the link mentioned by you and was able to resolve the issue.

    Sir, It would be really helpful if you could suggest me a book of any link where I can learn ORDBMS querying.

    Thanks a lot !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •