Borland®
Community
[an error occurred while processing this directive]  ENTERA DEVELOPER SUPPORT

Frequently Asked Questions

Username/password for FX servers at runtime

Question:

When I make an FX server using tpmake I enter the username and 
password for the DBMS into the .res file.  This works fine until
I move the server to another DBMS or try to access another database 
where the username/password is different.  Is there a way to set these 
values at runtime so I don't have to edit my .res file and 
recompile?

Answer:

The values in the .res file can be overloaded by setting 
environment variables.  For example - if you had the following
resource file:

#tag  file           db_name       DBMS     login     passwd
1     serve1.sql     mydb1         Oracle   user1     password1
2     serve2.sql     mydb2         Oracle   user2     password2
3     serve3.sql     mydb1         Oracle   user1     password1

By using the variables DB_NAME_<tag>, DB_LOGIN_<tag>, and DB_PWD_<TAG>
you can alter the database name, login, and password that the server
uses. To change the login and password for tag 2 (2 server2.sql mydb2
Oracle user2 password2) you would type the following from bash:

export DB_LOGIN_2=<new login name>
export DB_PWD_2=<new password>

Now when your FX server starts from this shell it will use the 
values you exported <new login name> and <new password> when
it connects to mydb2 on Oracle.

For a more detailed description see The Entera Reference
Manual -> Chapter2 -> Entera/Fx Resource Files -> Overriding
the default values.