cancel
Showing results for 
Search instead for 
Did you mean: 

Value based on Server name using Jco

former_member1275317
Participant
0 Kudos

i have a requirement where i need to pass the values based on DEV ,QA,PROD servers.

Initially we used to send these by assiging constant values.Now we want to retrive these values from table.For Ex In Dev sending value would be 123tst in Prod value would be 123.Also we are retriving some values from same table using JCO call,now we need extarct one more and it shud be compared with server.can we extract the server name by using JCO call..if so please let me the parameters required for the same..

OR Is there any otherway to retrieve the Hostname or application server name so that value can be sent based on that.

Regards,

Deep.

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

Using java code in UDF you can get HostName of Server and you can pass that information in the payload.

java.net.InetAddress.getLocalHost().getHostAddress();

Gives IP Address of the machine

java.net.InetAddress.getLocalHost().getHostName()

Gives The Host Name of the machine

Edited by: Praveen Gujjeti on Feb 27, 2009 3:40 PM

former_member1275317
Participant
0 Kudos

Praveen,

Thanks for quick response...

Can i get more information on this. please let me know the parameters that i need to use in the UDF,

Regards,

Deep.

former_member181985
Active Contributor
0 Kudos

write a UDF which returns the host name as string and pass this to one of the fields in mapping.

UDF Code

return ( java.net.InetAddress.getLocalHost().getHostName() );

No need of any import statements in the UDF.

Edited by: Praveen Gujjeti on Feb 27, 2009 3:55 PM

former_member1275317
Participant
0 Kudos

Thank you very much... Praveen

I need some clarification on these parameters.. can i use these in JCO call.. or do i need to create

UDF to get hostname... does this require any importing of packages.

Regards,

Deep.

former_member181985
Active Contributor
0 Kudos

you can use it in JCO also, as the above snippet is part of standard java API.

Answers (0)