Power to Build

Home » Misc » SYBASE EAServer: Taking Control – IP Address, Name

SYBASE EAServer: Taking Control – IP Address, Name

Recently I made some tweaks and upgraded our old Sybase EAServer (ver 5.5) to the maximum possible versions of PowerBuilder (12.5) and Java (1.5.0_22). It is sort of a band-aid, but we shuddered to move EAServer 6.x, as it was much slower and more error prone. After getting a lot of advice on the web, I decided to stay with EAServer 5.5. While at it, I also made some tweaks to the server settings. I posted some here.

Jaguar’s IP Address

While setting up the listeners in EAServer, we can the set the host address to either localhost or IP Address. localhost works only on local PCs. If you want to access the EAServer across the network, we need to set it to an IP Address (or a DNS registered server name). I wanted to standardize all our desktops and this was one of the settings that prevented from cloning. I decided to set it up, so it automatically gets the IP Address from the OS environment.

To do this, you will have the add the setting to one of the 3 batch file scripts (on Windows) that make up the Server startup – ServerStart, SetEnv, user_SetEnv. I decided to add it to the SetEnv.bat.

Surprisingly, there is no single command to find out your machine’s IP Address in Windows! IPCONFIG gets it, but there is a lot of gibberish around it. I decided to use PING command and take parts of it. Here is the piece of that script.

FOR /F "tokens=2,3" %%A IN ('PING %computername% -n 1 -4 ^| findstr "reply from"') DO IF "from"== "%%A" set "IP_ADDR=%%~B"

Note: That ^ is an escape char in Windows Batchfile scripts. Findstr functions similar to Grep on Unix – syntax is slightly different.

With the PING command you get “Reply from 10.x.x.x: …” and that repeats 3 times. In the For loop, we extract that and get rid of the “:”. This will give us,


I copy this to a more meaningful JAGUAR_IP_ADDRESS, which can then be used inside EAServer, thus:


Note: This technique may not work correctly, if your PING returns different output or if you have multiple public (adapter) addresses on your machine.

Using Computer Name inside EAServer

Another issue I found while setting up the Jaguar Server was finding its own name. I wanted to set this to the Computer Name, which is typically available in %COMPUTERNAME% variable on Windows. I set this into another meaningful ENV variable inside the SetEnv batch file.


Then, this will be available inside EAServer at runtime as,


I then set this into the JVM by adding it to the JVM arguments* as,


*you add this jvm options in Advanced settings for Server (typically JAGUAR)  in Jaguar Manager.

With this, I could then use host_name in any Java programs running inside the JVM running in EAServer.

Getting the server name in Java running inside EA Server by any other means is either difficult or may affect performance. For e.g., I used this variable (host_name) in log4J to print server name in the logs, like:

log4j.appender.ConsoleAppender.layout.ConversionPattern=%-5p %c %X{object} “%m” %X{identifier} ${host_name}%n/

I will post more on adding log4J in EAServer in a separate post.

By adding these simple tweaks,  i made the EA Servers and the programs running inside aware of its address and name.  You can get the same in a Java program, using InetAddress,  but it gets complicated and may even affect performance.

Comments, please?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: