Results 1 to 9 of 9

Thread: DB2 Port

  1. #1
    Join Date
    Feb 2005
    Posts
    14

    Unanswered: DB2 Port

    Hi

    I have my DB2 installation running in windows. How do i change the default port ?

    thanks in advance,
    saravanan

  2. #2
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    You Have To Append The New Port Name Against The Instance You Are Using @ Services File

    C:/winnt/system32/drivers/etc/services


    Jayanta

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    update dbm cfg using svcename <new port>
    or
    change the port number for the service name your instance uses.
    get dbm cfg | find "SVCENAME"

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  4. #4
    Join Date
    Feb 2005
    Posts
    14
    Thanks for the replies. I also want to find the current port in which it is running. (Sorry, I'm new to DB2)

    Thanks for your timely help.

    Regards,
    saravanan

  5. #5
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    As sathyram is saying first get the svcename for the db manager

    get dbm cfg | find "SVCENAME"

    Now go to the services file at:

    c:/winnt/system32/drivers/etc/services

    Here in this file, against the SVCENAME you will find the existing port number. The default value is 50000.

    Thanks,
    jayanta datta
    Xansa India
    Delhi
    ----------------------

    Enclosed few lines may help you to understand it better

    To reserve TCP port 50001 for the service named db2icdb2, append the following line to the services file:


    db2icdb2 50001/tcp


    Update the database manager configuration file so that DB2 will use the port number associated with the service db2icdb2 for the instance you are working on:


    db2 update database manager configuration using svcename db2icdb2


    If you choose not to use the services file, simply update svcename with the correct port number:


    db2 update database manager configuration using svcename 50001

  6. #6
    Join Date
    Feb 2005
    Posts
    14
    Thanks Jayanta. But it seems i can not use this port to connect to DB2 from a java application (using JDBC). How do i know the port which can be used for connection from a java application ?

    Regards,
    saravanan

  7. #7
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    Please send the code that you are writing to connect to db2 using JDBC.

    Infact your Java application server machine needs to configured to the DB2 server machine with correct port number and Server name.

  8. #8
    Join Date
    Feb 2005
    Posts
    14
    The code is :

    Code:
    String driverClass = "COM.ibm.db2.jdbc.net.DB2Driver";
    String url = "jdbc:db2://localhost:1234/demo";
    String userName = "db2";
    String password = "db2";
    Class.forName(driverClass);
    conn = DriverManager.getConnection(url, userName, password);
    Here is 1234 is port number. It does not connect since the port is something else. How do i find it out ?

    thanks,
    saravanan

  9. #9
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    1234 isnot the port for DB2. It is the port which your local host for Java application would use. I would suggest you please verify the settings of JDBC and DB connectivity from a person in your project / team who has worked on JDBC connectiviy (with DB2 as the database).

Posting Permissions

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