If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Port

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-05, 05:22
asjsaravanan asjsaravanan is offline
Registered User
 
Join Date: Feb 2005
Posts: 14
DB2 Port

Hi

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

thanks in advance,
saravanan
Reply With Quote
  #2 (permalink)  
Old 03-10-05, 06:45
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
You Have To Append The New Port Name Against The Instance You Are Using @ Services File

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


Jayanta
Reply With Quote
  #3 (permalink)  
Old 03-10-05, 06:49
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
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.
Reply With Quote
  #4 (permalink)  
Old 03-10-05, 07:02
asjsaravanan asjsaravanan is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 03-10-05, 07:16
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
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
Reply With Quote
  #6 (permalink)  
Old 03-10-05, 07:49
asjsaravanan asjsaravanan is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 03-10-05, 08:15
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
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.
Reply With Quote
  #8 (permalink)  
Old 03-10-05, 08:24
asjsaravanan asjsaravanan is offline
Registered User
 
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
Reply With Quote
  #9 (permalink)  
Old 03-10-05, 11:11
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
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).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On