Setting connection properties

Connection properties must be set before connecting to a server. You can set connection properties in two ways:

Following is a sample code that uses the DriverManager.getConnection method. The sample programs provided with jConnect also contain examples of setting these properties.

 Properties props = new Properties();
  props.put("user", "userid");
  props.put("password", "user_password");
 /*
  * If the program is an applet that wants to access
  * a server that is not on the same host as the
  * web server, then it uses a proxy gateway.
  */
  props.put("proxy", "localhost:port");
 /*
  * Make sure you set connection properties before
  * attempting to make a connection. You can also
  * set the properties in the URL.
  */
 Connection con = DriverManager.getConnection
   ("jdbc:sybase:Tds:host:port", props);