Performing server-to-server remote procedure calls

A Transact-SQL language command or stored procedure running on one server can execute a stored procedure located on another server. The server to which an application has connected logs in to the remote server, and executes a server-to-server remote procedure call.

An application can specify a “universal” password for server-to-server communication, that is, a password used in all server-to-server connections. Once the connection is open, the server uses this password to log in to any remote server. By default, jConnect uses the password of the current connection as the default password for server-to-server communications.

However, if the passwords are different on two servers for the same user, and that user is performing server-to-server remote procedure calls, the application must explicitly define passwords for each server it plans to use.

jConnect includes a property that enables you to set a universal “remote” password or different passwords on several servers. jConnect allows you to set and configure the property using the setRemotePassword method in the SybDriver class:

Properties connectionProps = new Properties();

public final void setRemotePassword(String serverName, 
    String password, Properties connectionProps)

To use this method, the application must import the SybDriver class, then call the method:

import com.sybase.jdbcx.SybDriver;
SybDriver sybDriver = (SybDriver)
    Class.forName("com.sybase.jdbc4.jdbc.SybDriver").newInstance();
sybDriver.setRemotePassword
    (serverName, password, connectionProps);

NoteTo set different remote passwords for various servers, repeat the preceding call for each server.

This call adds the given server name-password pair to the given Properties object, which can be passed by the application to DriverManager in DriverManager.getConnection (server_url, props).

If serverName is null, the universal password is set to password for subsequent connections to all servers except the ones specifically defined by previous calls to setRemotePassword.

When an application sets the REMOTEPWD property, jConnect no longer sets the default universal password.